Merge lp:~mhall119/loco-team-portal/fixes-619883 into lp:loco-team-portal

Proposed by Michael Hall
Status: Merged
Approved by: Chris Johnston
Approved revision: 244
Merged at revision: 244
Proposed branch: lp:~mhall119/loco-team-portal/fixes-619883
Merge into: lp:loco-team-portal
Diff against target: 64 lines (+9/-9)
3 files modified
loco_directory/common/views.py (+3/-3)
loco_directory/events/models.py (+4/-4)
loco_directory/templates/index.html (+2/-2)
To merge this branch: bzr merge lp:~mhall119/loco-team-portal/fixes-619883
Reviewer Review Type Date Requested Status
Chris Johnston Approve
Review via email: mp+33008@code.launchpad.net

Description of the change

I had initially limited the upcoming events because I was going to display team events. Since we're not doing that, I don't think we need a limit. Also, instead of passing the entire list of team events to the template context, I'm only passing the count now.

To post a comment you must log in.
Revision history for this message
Chris Johnston (cjohnston) wrote :

The order needs to be changed for global events to where date_end is displayed first.

review: Needs Fixing
244. By Michael Hall

Short events by end_date rather than begin_date, so the ones ending soonest come first

Revision history for this message
Chris Johnston (cjohnston) wrote :

Great!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/common/views.py'
2--- loco_directory/common/views.py 2010-08-15 20:11:04 +0000
3+++ loco_directory/common/views.py 2010-08-18 16:21:44 +0000
4@@ -8,9 +8,9 @@
5
6 def index(request):
7 from events.models import GlobalEvent, TeamEvent
8- team_event_list = TeamEvent.objects.next_events()[:5]
9- global_event_list = GlobalEvent.objects.next_events()[:2]
10- context = {'team_event_list': team_event_list,
11+ team_event_count = TeamEvent.objects.next_events().count()
12+ global_event_list = GlobalEvent.objects.next_events()[:5]
13+ context = {'team_event_count': team_event_count,
14 'global_event_list': global_event_list,}
15
16 return render_to_response('index.html', context,
17
18=== modified file 'loco_directory/events/models.py'
19--- loco_directory/events/models.py 2010-08-17 01:55:04 +0000
20+++ loco_directory/events/models.py 2010-08-18 16:21:44 +0000
21@@ -50,11 +50,11 @@
22 """ manager for a global event """
23 def next_events(self):
24 """ a list with all upcoming global events """
25- return self.filter(date_end__gt=datetime.datetime.now()).order_by('-date_begin')
26+ return self.filter(date_end__gt=datetime.datetime.now()).order_by('date_end')
27
28 def history_events(self):
29 """ all global events in history """
30- return self.filter(date_end__lt=datetime.datetime.now()).order_by('-date_begin')
31+ return self.filter(date_end__lt=datetime.datetime.now()).order_by('date_end')
32
33 def random_5(self):
34 """ return 5 random Team Events for this global event """
35@@ -87,12 +87,12 @@
36 def next_5_events(self):
37 """ a list with the next 5 events """
38 # XXX: Workaround for https://bugs.launchpad.net/loco-directory/+bug/531970
39- return self.filter(date_end__gt=datetime.datetime.now()-datetime.timedelta(days=1)).order_by('date_begin')[:5]
40+ return self.filter(date_end__gt=datetime.datetime.now()-datetime.timedelta(days=1)).order_by('date_end')[:5]
41
42 def next_events(self):
43 """ a list with all upcoming team events """
44 # XXX: Workaround for https://bugs.launchpad.net/loco-directory/+bug/531970
45- return self.filter(date_end__gt=datetime.datetime.now()-datetime.timedelta(days=1)).order_by('date_begin')
46+ return self.filter(date_end__gt=datetime.datetime.now()-datetime.timedelta(days=1)).order_by('date_end')
47
48 def history_events(self):
49 """ all team events in history """
50
51=== modified file 'loco_directory/templates/index.html'
52--- loco_directory/templates/index.html 2010-08-17 15:09:14 +0000
53+++ loco_directory/templates/index.html 2010-08-18 16:21:44 +0000
54@@ -65,8 +65,8 @@
55 {% endif %}
56
57 <br />
58- {% if team_event_list %}
59- <h3><a href="{% url event-list %}">{{ team_event_list.count }} {% trans "Upcoming Team Events" %}</a>
60+ {% if team_event_count %}
61+ <h3><a href="{% url event-list %}">{{ team_event_count }} {% trans "Upcoming Team Events" %}</a>
62 <a class="teams_event_ical" href="{% url teams-event-list-ical %}">
63 <img src="/media/images/ical.png" title="{% trans "Team Events as ical" %}"/></a></h3>
64 {% else %}

Subscribers

People subscribed via source and target branches