Author: adrian
Date: 2008-09-16 00:50:03 -0500 (Tue, 16 Sep 2008)
New Revision: 9045

Modified:
   django/trunk/django/contrib/admin/templatetags/log.py
Log:
Fixed #9083 -- Improved get_admin_log template tag so that it doesn't run a 
separate SQL query for every record in the 'history' sidebar on the admin 
homepage. Thanks for the patch, santip

Modified: django/trunk/django/contrib/admin/templatetags/log.py
===================================================================
--- django/trunk/django/contrib/admin/templatetags/log.py       2008-09-16 
05:42:11 UTC (rev 9044)
+++ django/trunk/django/contrib/admin/templatetags/log.py       2008-09-16 
05:50:03 UTC (rev 9045)
@@ -12,11 +12,11 @@
 
     def render(self, context):
         if self.user is None:
-            context[self.varname] = 
LogEntry.objects.all().select_related()[:self.limit]
+            context[self.varname] = 
LogEntry.objects.all().select_related('content_type', 'user')[:self.limit]
         else:
             if not self.user.isdigit():
                 self.user = context[self.user].id
-            context[self.varname] = 
LogEntry.objects.filter(user__id__exact=self.user).select_related()[:self.limit]
+            context[self.varname] = 
LogEntry.objects.filter(user__id__exact=self.user).select_related('content_type',
 'user')[:self.limit]
         return ''
 
 class DoGetAdminLog:


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to