Daniel Holbach has proposed merging lp:~dholbach/loco-directory/596826 into 
lp:loco-directory.

Requested reviews:
  loco-directory-dev (loco-directory-dev)
Related bugs:
  #596826 list venues by continent and country
  https://bugs.launchpad.net/bugs/596826

-- 
https://code.launchpad.net/~dholbach/loco-directory/596826/+merge/30531
Your team loco-directory-dev is requested to review the proposed merge of 
lp:~dholbach/loco-directory/596826 into lp:loco-directory.
=== modified file 'loco_directory/templates/venues/venue_list.html'
--- loco_directory/templates/venues/venue_list.html	2010-06-24 19:18:57 +0000
+++ loco_directory/templates/venues/venue_list.html	2010-07-21 13:37:46 +0000
@@ -24,8 +24,10 @@
 {% if venue_list %}
 <p>{% trans "Select a Venue below to see more information about it:" %}</p>
 
+{% for continent in continents %}
+   <h2>{{ continent.name }}</h2>
 {% regroup venue_list by country as venue_country_list %}    
-{% for country in venue_country_list %}
+{% for country in venue_country_list %}{% for cont in country.grouper.continents.all %}{% ifequal cont continent %}
     <h3>{{ country.grouper }}</h3>
     <ul>
         {% for venue in country.list %}
@@ -33,8 +35,8 @@
         {% endfor %}    
     </ul>
     <br style="clear:left;">
+{% endifequal %}{% endfor %}{% endfor %}
 {% endfor %}
-
 {% else %}
 <p>{% trans "There are currently no LoCo Venues :(" %}</p>
 {% endif %}

=== modified file 'loco_directory/venues/views.py'
--- loco_directory/venues/views.py	2010-06-19 20:20:12 +0000
+++ loco_directory/venues/views.py	2010-07-21 13:37:46 +0000
@@ -9,6 +9,7 @@
 
 from models import Venue
 from forms import VenueForm, VenueSearchForm
+from teams.models import Continent
 
 
 
@@ -22,11 +23,17 @@
         if form.cleaned_data['q']:
             q = form.cleaned_data['q']
             venue_list = venue_list.filter(Q(name__icontains=q) | Q(country__name__icontains=q) | Q(city__icontains=q) | Q(address__icontains=q))
-    
+
+    continent_ids = []
+    for continent_list in map(lambda a: a.country.continents.all(), venue_list):
+        continent_ids += [continent.id for continent in continent_list]
+    continents = Continent.objects.filter(id__in=continent_ids).order_by('name')
+
     venue_list = venue_list.order_by('country')
     context = {
         'form': form,
         'venue_list': venue_list,
+        'continents': continents,
     }
     return render_to_response('venues/venue_list.html', context,
                   RequestContext(request))

_______________________________________________
Mailing list: https://launchpad.net/~loco-directory-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~loco-directory-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to