From af23d8d3b38270f58404c002942bcc200f1855bf Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Tue, 16 Sep 2008 05:50:03 +0000 Subject: [PATCH] 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 git-svn-id: http://code.djangoproject.com/svn/django/trunk@9045 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/templatetags/log.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/templatetags/log.py b/django/contrib/admin/templatetags/log.py index 8d52d2e944..84c7e6c7a6 100644 --- a/django/contrib/admin/templatetags/log.py +++ b/django/contrib/admin/templatetags/log.py @@ -12,11 +12,11 @@ class AdminLogNode(template.Node): 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: