Merge lp:~mhall119/loco-team-portal/geo-grouping into lp:~dholbach/loco-team-portal/geo-grouping

Proposed by Michael Hall
Status: Merged
Merged at revision: 206
Proposed branch: lp:~mhall119/loco-team-portal/geo-grouping
Merge into: lp:~dholbach/loco-team-portal/geo-grouping
Diff against target: 206 lines (+52/-25)
6 files modified
loco_directory/common/utils.py (+28/-0)
loco_directory/teams/models.py (+2/-2)
loco_directory/teams/views.py (+2/-1)
loco_directory/templates/teams/team_list.html (+11/-17)
loco_directory/templates/venues/venue_list.html (+7/-4)
loco_directory/venues/views.py (+2/-1)
To merge this branch: bzr merge lp:~mhall119/loco-team-portal/geo-grouping
Reviewer Review Type Date Requested Status
Daniel Holbach Approve
Review via email: mp+31428@code.launchpad.net

Description of the change

Fixes some problems with the col_left/col_right placement of teams and venues, and lists teams by continent not continent+country

To post a comment you must log in.
Revision history for this message
Daniel Holbach (dholbach) wrote :

Good work.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'loco_directory/common/utils.py'
--- loco_directory/common/utils.py 2010-07-28 13:01:58 +0000
+++ loco_directory/common/utils.py 2010-07-30 20:58:59 +0000
@@ -1,5 +1,6 @@
1import email1import email
2import os2import os
3from copy import deepcopy
34
4def flat_list(some_list):5def flat_list(some_list):
5 """6 """
@@ -41,3 +42,30 @@
41 pass42 pass
4243
43 return "version %s (rev %s)" % (version, bzr_revno)44 return "version %s (rev %s)" % (version, bzr_revno)
45
46class simple_iterator(object):
47
48 def __init__(self, *args):
49 self.values = []
50 self.index = -1
51 if len(args) == 1 and isinstance(args[0], (list, tuple, set)):
52 self.values.extend(deepcopy(args[0]))
53 else:
54 self.values.extend(deepcopy(args))
55
56 def get_next_index(self):
57 if self.index + 1 >= len(self.values):
58 self.index = 0
59 else:
60 self.index = self.index + 1
61 return self.index
62 next_index = property(get_next_index)
63
64 def get_next(self):
65 return self.values[self.next_index]
66 next = property(get_next)
67
68 def reset(self):
69 self.index = -1
70 return ''
71
4472
=== modified file 'loco_directory/teams/models.py'
--- loco_directory/teams/models.py 2010-07-29 13:53:43 +0000
+++ loco_directory/teams/models.py 2010-07-30 20:58:59 +0000
@@ -32,11 +32,11 @@
3232
33 @property33 @property
34 def related_venues(self):34 def related_venues(self):
35 return flat_list([a.related_venues for a in self.related_countries])35 return flat_list([list(a.related_venues) for a in self.related_countries])
36 36
37 @property37 @property
38 def related_teams(self):38 def related_teams(self):
39 return flat_list([a.related_teams for a in self.related_countries])39 return flat_list([list(a.related_teams) for a in self.related_countries])
4040
41class Country(models.Model):41class Country(models.Model):
42 name = models.TextField(_("Name"), max_length=100)42 name = models.TextField(_("Name"), max_length=100)
4343
=== modified file 'loco_directory/teams/views.py'
--- loco_directory/teams/views.py 2010-07-29 13:53:43 +0000
+++ loco_directory/teams/views.py 2010-07-30 20:58:59 +0000
@@ -12,7 +12,7 @@
1212
13from django import http13from django import http
1414
15from common.utils import redirect15from common.utils import redirect, simple_iterator
16from common import launchpad16from common import launchpad
1717
18from teams.models import Continent, Team, countries_without_continent, countries_without_continent_have_teams, teams_without_country18from teams.models import Continent, Team, countries_without_continent, countries_without_continent_have_teams, teams_without_country
@@ -57,6 +57,7 @@
57 'countries_without_continent': countries_without_continent().order_by('name'),57 'countries_without_continent': countries_without_continent().order_by('name'),
58 'countries_without_continent_have_teams': countries_without_continent_have_teams(),58 'countries_without_continent_have_teams': countries_without_continent_have_teams(),
59 'teams_without_country': teams_without_country().order_by('name'),59 'teams_without_country': teams_without_country().order_by('name'),
60 'colcycle' : simple_iterator('col_left', 'col_right'),
60 }61 }
61 return render_to_response('teams/team_list.html', context,62 return render_to_response('teams/team_list.html', context,
62 RequestContext(request))63 RequestContext(request))
6364
=== modified file 'loco_directory/templates/teams/team_list.html'
--- loco_directory/templates/teams/team_list.html 2010-07-29 13:53:43 +0000
+++ loco_directory/templates/teams/team_list.html 2010-07-30 20:58:59 +0000
@@ -20,43 +20,37 @@
20{% block content %}20{% block content %}
21<article id="main-content" class="main-content">21<article id="main-content" class="main-content">
22{% if team_list %}22{% if team_list %}
23 {% for continent in continents %}23 {% for continent in continents %}{% if continent.related_teams %}
24 {% if continent.related_teams %}
25 <h2>{{continent.name}}</h2>24 <h2>{{continent.name}}</h2>
26 {% for country in continent.related_countries %}
27 {% if country.related_teams %}
28 <h3>{{country.name}}</h3>
29 <ul>25 <ul>
30 {% for team in country.related_teams %}26 {{colcycle.reset}}
31 <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>27 {% for team in continent.related_teams %}
28 <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 %} {{colcycle.next}}"><a href="{{ team.get_absolute_url }}">{{ team.name }}</a></li>
32 {% endfor %}29 {% endfor %}
33 </ul>30 </ul>
34 <br class="clear" />31 <br class="clear" />
35 {% endif %}32 {% endif %}{% endfor %}
36 {% endfor %}
37 {% endif %}
38 {% endfor %}
3933
40 {% if countries_without_continent_have_teams %}34 {% if countries_without_continent_have_teams %}
41 <h2>{% trans "Countries without continent" %}</h2>35 <h2>{% trans "Countries without continent" %}</h2>
42 {% for country in countries_without_continent %}36 {% for country in countries_without_continent %}{% if country.related_teams %}
43 {% if country.related_teams %}
44 <h3>{{country.name}}</h3>37 <h3>{{country.name}}</h3>
45 <ul>38 <ul>
39 {{colcycle.reset}}
46 {% for team in country.related_teams %}40 {% for team in country.related_teams %}
47 <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>41 <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 %} {{colcycle.next}}"><a href="{{ team.get_absolute_url }}">{{ team.name }}</a></li>
48 {% endfor %}42 {% endfor %}
49 </ul>43 </ul>
50 <br class="clear" />44 <br class="clear" />
51 {% endif %} 45 {% endif %}{% endfor %}
52 {% endfor %}
53 {% endif %}46 {% endif %}
5447
55 {% if teams_without_country %}48 {% if teams_without_country %}
56 <h2>{% trans "Teams without country" %}</h2>49 <h2>{% trans "Teams without country" %}</h2>
57 <ul>50 <ul>
51 {{colcycle.reset}}
58 {% for team in teams_without_country %}52 {% for team in teams_without_country %}
59 <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>53 <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 %} {{colcycle.next}}"><a href="{{ team.get_absolute_url }}">{{ team.name }}</a></li>
60 {% endfor %}54 {% endfor %}
61 </ul>55 </ul>
62 <br class="clear" />56 <br class="clear" />
6357
=== modified file 'loco_directory/templates/venues/venue_list.html'
--- loco_directory/templates/venues/venue_list.html 2010-07-29 13:54:09 +0000
+++ loco_directory/templates/venues/venue_list.html 2010-07-30 20:58:59 +0000
@@ -17,7 +17,7 @@
17{% endblock %}17{% endblock %}
1818
19{% block content %}19{% block content %}
20<article class="main-content">20<article id="main-content" class="main-content">
2121
22<h2>{% trans "Ubuntu LoCo Venues" %}</h2>22<h2>{% trans "Ubuntu LoCo Venues" %}</h2>
2323
@@ -31,8 +31,9 @@
31 {% if country.related_venues %}31 {% if country.related_venues %}
32 <h3>{{country.name}}</h3>32 <h3>{{country.name}}</h3>
33 <ul>33 <ul>
34 {{colcycle.reset}}
34 {% for venue in country.related_venues %}35 {% for venue in country.related_venues %}
35 <li class="{% if forloop.counter|divisibleby:2 %}col_right{% else %}col_left{% endif %}"><a title="{% trans "show venue details" %}" href="{{ venue.get_absolute_url }}">{{ venue.name }}{% if venue.city %}, {{ venue.city }}{% endif %}</a></li>36 <li class="{{colcycle.next}}"><a title="{% trans "show venue details" %}" href="{{ venue.get_absolute_url }}">{{ venue.name }}{% if venue.city %}, {{ venue.city }}{% endif %}</a></li>
36 {% endfor %}37 {% endfor %}
37 </ul>38 </ul>
38 <br style="clear:left;">39 <br style="clear:left;">
@@ -47,8 +48,9 @@
47 {% if country.related_venues %}48 {% if country.related_venues %}
48 <h3>{{country.name}}</h3>49 <h3>{{country.name}}</h3>
49 <ul>50 <ul>
51 {{colcycle.reset}}
50 {% for venue in country.related_venues %}52 {% for venue in country.related_venues %}
51 <li class="{% if forloop.counter|divisibleby:2 %}col_right{% else %}col_left{% endif %}"><a title="{% trans "show venue details" %}" href="{{ venue.get_absolute_url }}">{{ venue.name }}{% if venue.city %}, {{ venue.city }}{% endif %}</a></li>53 <li class="{{colcycle.next}}"><a title="{% trans "show venue details" %}" href="{{ venue.get_absolute_url }}">{{ venue.name }}{% if venue.city %}, {{ venue.city }}{% endif %}</a></li>
52 {% endfor %}54 {% endfor %}
53 </ul>55 </ul>
54 <br style="clear:left;">56 <br style="clear:left;">
@@ -59,8 +61,9 @@
59 {% if venues_without_country %}61 {% if venues_without_country %}
60 <h2>{% trans "Venues without Country" %}</h2>62 <h2>{% trans "Venues without Country" %}</h2>
61 <ul>63 <ul>
64 {{colcycle.reset}}
62 {% for venue in venues_without_country %}65 {% for venue in venues_without_country %}
63 <li class="{% if forloop.counter|divisibleby:2 %}col_right{% else %}col_left{% endif %}"><a title="{% trans "show venue details" %}" href="{{ venue.get_absolute_url }}">{{ venue.name }}{% if venue.city %}, {{ venue.city }}{% endif %}</a></li>66 <li class="{{colcycle.next}}"><a title="{% trans "show venue details" %}" href="{{ venue.get_absolute_url }}">{{ venue.name }}{% if venue.city %}, {{ venue.city }}{% endif %}</a></li>
64 {% endfor %}67 {% endfor %}
65 </ul>68 </ul>
66 <br style="clear:left;">69 <br style="clear:left;">
6770
=== modified file 'loco_directory/venues/views.py'
--- loco_directory/venues/views.py 2010-07-29 13:54:09 +0000
+++ loco_directory/venues/views.py 2010-07-30 20:58:59 +0000
@@ -11,7 +11,7 @@
11from models import Venue, venues_without_country11from models import Venue, venues_without_country
12from forms import VenueForm, VenueSearchForm12from forms import VenueForm, VenueSearchForm
1313
1414from common.utils import simple_iterator
1515
16def venue_list(request):16def venue_list(request):
17 """17 """
@@ -32,6 +32,7 @@
32 'countries_without_continent': countries_without_continent().order_by('name'),32 'countries_without_continent': countries_without_continent().order_by('name'),
33 'countries_without_continent_have_venues': countries_without_continent_have_venues(),33 'countries_without_continent_have_venues': countries_without_continent_have_venues(),
34 'venues_without_country': venues_without_country().order_by('name'),34 'venues_without_country': venues_without_country().order_by('name'),
35 'colcycle' : simple_iterator('col_left', 'col_right'),
3536
36 }37 }
37 return render_to_response('venues/venue_list.html', context,38 return render_to_response('venues/venue_list.html', context,

Subscribers

People subscribed via source and target branches

to all changes: