Ronnie has proposed merging
lp:~ronnie.vd.c/loco-team-portal/event-history-reduced-queries into
lp:loco-team-portal.
Requested reviews:
LoCo Team Portal Developers (loco-directory-dev)
Related bugs:
Bug #830592 in LoCo Team Portal: "Improving performance"
https://bugs.launchpad.net/loco-team-portal/+bug/830592
For more details, see:
https://code.launchpad.net/~ronnie.vd.c/loco-team-portal/event-history-reduced-queries/+merge/82075
Reduced the amount of queries on the event history page bij 33%. From around
5000 to 3000.
The main problem that still exists is the o2m relation between teamevents and
teams
--
https://code.launchpad.net/~ronnie.vd.c/loco-team-portal/event-history-reduced-queries/+merge/82075
Your team LoCo Team Portal Developers is requested to review the proposed merge
of lp:~ronnie.vd.c/loco-team-portal/event-history-reduced-queries into
lp:loco-team-portal.
=== modified file 'loco_directory/events/views.py'
--- loco_directory/events/views.py 2011-03-18 13:37:13 +0000
+++ loco_directory/events/views.py 2011-11-13 11:48:23 +0000
@@ -6,6 +6,7 @@
from django.utils import simplejson
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
+from django.db.models import Count
from events.models import TeamEvent
from events.models import GlobalEvent
@@ -88,8 +89,8 @@
"""
a list with all historical events (teamevents and globalevents)
"""
- team_event_list = TeamEvent.objects.history_events()
- global_event_list = GlobalEvent.objects.history_events()
+ team_event_list = TeamEvent.objects.history_events().select_related('global_event', 'venue')
+ global_event_list = GlobalEvent.objects.history_events().annotate(num_teamevents=Count('teamevent'))
context = {
'team_event_list': team_event_list,
'global_event_list': global_event_list,
=== modified file 'loco_directory/templates/events/global_event_list.inc.html'
--- loco_directory/templates/events/global_event_list.inc.html 2011-07-23 22:54:02 +0000
+++ loco_directory/templates/events/global_event_list.inc.html 2011-11-13 11:48:23 +0000
@@ -18,7 +18,7 @@
</td>
<td class="event_begin no-wrap">{{global_event.date_begin|date}}</td>
<td class="event_end no-wrap">{{global_event.date_end|date}}</td>
- <td class="event_teams no-wrap">{{global_event.teamevent_set.all.count}}</td>
+ <td class="event_teams no-wrap">{{global_event.num_teamevents}}</td>
</tr>
{% endfor %}
</tbody>
=== modified file 'loco_directory/templates/events/team_event_list.inc.html'
--- loco_directory/templates/events/team_event_list.inc.html 2011-07-20 17:40:18 +0000
+++ loco_directory/templates/events/team_event_list.inc.html 2011-11-13 11:48:23 +0000
@@ -25,8 +25,8 @@
{% endif %}
{% endfor %}
</td>
- <td class="event_begin no-wrap">{{team_event.local_date_begin|date}} {{ team_event.local_date_begin|date:"H:i T"}}</td>
- <td class="event_end no-wrap">{{team_event.local_date_end|date}} {{ team_event.local_date_end|date:"H:i T"}}</td>
+ <td class="event_begin no-wrap">{{team_event.local_date_begin|date:"N j, Y H:i T"}}</td>
+ <td class="event_end no-wrap">{{ team_event.local_date_end|date:"N j, Y H:i T"}}</td>
<td class="event_global no-wrap">
{% if team_event.global_event %}
<a href="{{ team_event.global_event.get_absolute_url }}">{{ team_event.global_event.name}}</a>
_______________________________________________
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