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
=== modified file 'loco_directory/common/views.py'
--- loco_directory/common/views.py 2010-08-15 20:11:04 +0000
+++ loco_directory/common/views.py 2010-08-18 16:21:44 +0000
@@ -8,9 +8,9 @@
88
9def index(request):9def index(request):
10 from events.models import GlobalEvent, TeamEvent10 from events.models import GlobalEvent, TeamEvent
11 team_event_list = TeamEvent.objects.next_events()[:5]11 team_event_count = TeamEvent.objects.next_events().count()
12 global_event_list = GlobalEvent.objects.next_events()[:2]12 global_event_list = GlobalEvent.objects.next_events()[:5]
13 context = {'team_event_list': team_event_list,13 context = {'team_event_count': team_event_count,
14 'global_event_list': global_event_list,}14 'global_event_list': global_event_list,}
1515
16 return render_to_response('index.html', context,16 return render_to_response('index.html', context,
1717
=== modified file 'loco_directory/events/models.py'
--- loco_directory/events/models.py 2010-08-17 01:55:04 +0000
+++ loco_directory/events/models.py 2010-08-18 16:21:44 +0000
@@ -50,11 +50,11 @@
50 """ manager for a global event """50 """ manager for a global event """
51 def next_events(self):51 def next_events(self):
52 """ a list with all upcoming global events """52 """ a list with all upcoming global events """
53 return self.filter(date_end__gt=datetime.datetime.now()).order_by('-date_begin')53 return self.filter(date_end__gt=datetime.datetime.now()).order_by('date_end')
54 54
55 def history_events(self):55 def history_events(self):
56 """ all global events in history """56 """ all global events in history """
57 return self.filter(date_end__lt=datetime.datetime.now()).order_by('-date_begin')57 return self.filter(date_end__lt=datetime.datetime.now()).order_by('date_end')
5858
59 def random_5(self):59 def random_5(self):
60 """ return 5 random Team Events for this global event """60 """ return 5 random Team Events for this global event """
@@ -87,12 +87,12 @@
87 def next_5_events(self):87 def next_5_events(self):
88 """ a list with the next 5 events """88 """ a list with the next 5 events """
89# XXX: Workaround for https://bugs.launchpad.net/loco-directory/+bug/53197089# XXX: Workaround for https://bugs.launchpad.net/loco-directory/+bug/531970
90 return self.filter(date_end__gt=datetime.datetime.now()-datetime.timedelta(days=1)).order_by('date_begin')[:5]90 return self.filter(date_end__gt=datetime.datetime.now()-datetime.timedelta(days=1)).order_by('date_end')[:5]
9191
92 def next_events(self):92 def next_events(self):
93 """ a list with all upcoming team events """93 """ a list with all upcoming team events """
94# XXX: Workaround for https://bugs.launchpad.net/loco-directory/+bug/53197094# XXX: Workaround for https://bugs.launchpad.net/loco-directory/+bug/531970
95 return self.filter(date_end__gt=datetime.datetime.now()-datetime.timedelta(days=1)).order_by('date_begin')95 return self.filter(date_end__gt=datetime.datetime.now()-datetime.timedelta(days=1)).order_by('date_end')
9696
97 def history_events(self):97 def history_events(self):
98 """ all team events in history """98 """ all team events in history """
9999
=== modified file 'loco_directory/templates/index.html'
--- loco_directory/templates/index.html 2010-08-17 15:09:14 +0000
+++ loco_directory/templates/index.html 2010-08-18 16:21:44 +0000
@@ -65,8 +65,8 @@
65 {% endif %}65 {% endif %}
66 66
67 <br />67 <br />
68 {% if team_event_list %}68 {% if team_event_count %}
69 <h3><a href="{% url event-list %}">{{ team_event_list.count }} {% trans "Upcoming Team Events" %}</a>69 <h3><a href="{% url event-list %}">{{ team_event_count }} {% trans "Upcoming Team Events" %}</a>
70 <a class="teams_event_ical" href="{% url teams-event-list-ical %}">70 <a class="teams_event_ical" href="{% url teams-event-list-ical %}">
71 <img src="/media/images/ical.png" title="{% trans "Team Events as ical" %}"/></a></h3>71 <img src="/media/images/ical.png" title="{% trans "Team Events as ical" %}"/></a></h3>
72 {% else %}72 {% else %}

Subscribers

People subscribed via source and target branches