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

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


If somebody wants to rework the CSS, that'd be nice. :-D
-- 
https://code.launchpad.net/~dholbach/loco-directory/596823/+merge/30501
Your team loco-directory-dev is requested to review the proposed merge of 
lp:~dholbach/loco-directory/596823 into lp:loco-directory.
=== modified file 'loco_directory/teams/views.py'
--- loco_directory/teams/views.py	2010-07-15 13:37:00 +0000
+++ loco_directory/teams/views.py	2010-07-21 10:04:08 +0000
@@ -16,7 +16,7 @@
 from common.utils import redirect
 from common import launchpad
 
-from models import Team
+from models import Team, Continent
 
 import forms
 
@@ -51,8 +51,15 @@
             q = form.cleaned_data['q']
             team_list = team_list.filter(Q(name__icontains=q) | Q(countries__name__icontains=q) | Q(city__icontains=q) | Q(languages__name__icontains=q))
 
+    continent_ids = []
+    for country_list in [team.countries.all() for team in team_list]:
+        for country in country_list:
+            continent_ids += [continent.id for continent in country.continents.all()]
+    continents = Continent.objects.filter(id__in=continent_ids).order_by('name')
+
     context = {
         'team_list': team_list,
+        'continents': continents,
         'form': form,
     }
     return render_to_response('teams/team_list.html', context,
@@ -64,7 +71,6 @@
     """
     team_object = get_object_or_404(Team, lp_name=team_slug)
     team_event_list = team_object.teamevent_set.next_events()
-    print team_event_list
     context = {
         'team_object': team_object,
         'team_event_list': team_event_list,

=== modified file 'loco_directory/templates/teams/team_list.html'
--- loco_directory/templates/teams/team_list.html	2010-07-15 07:56:44 +0000
+++ loco_directory/templates/teams/team_list.html	2010-07-21 10:04:08 +0000
@@ -21,8 +21,13 @@
 <article id="main-content" class="main-content">
 {% if team_list %}
 <ul>
-{% for team in team_list %}
-<li title="{% if team.approved %}{% blocktrans with team.name as teamname %}{{ teamname }} approved{% endblocktrans %}{% else %}{% blocktrans with team.name as teamname %}{{ teamname }} not approved{% endblocktrans %}{% endif %}" class="{% if team.approved %}approved{% else %}unapproved{% endif %} {% cycle 'col_left' 'col_right' %}"><a href="{{ team.get_absolute_url }}">{{ team.name }}</a></li>
+{% for continent in continents %}
+<li>{{ continent.name }}
+<ul>
+{% for team in team_list %}{% for count in team.countries.all %}{% for cont in count.continents.all %}{% ifequal cont continent %}
+<li title="{% if team.approved %}{% blocktrans with team.name as teamname %}{{ teamname }} approved{% endblocktrans %}{% else %}{% blocktrans with team.name as teamname %}{{ teamname }} not approved{% endblocktrans %}{% endif %}" class="{% if team.approved %}approved{% else %}unapproved{% endif %}"><a href="{{ team.get_absolute_url }}">{{ team.name }}</a></li>
+{% endifequal %}{% endfor %}{% endfor %}{% endfor %}
+</ul>
 {% endfor %}
 </ul>
 <br class="clear" />

_______________________________________________
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