Commit af23d8d3 authored by Adrian Holovaty's avatar Adrian Holovaty
Browse files

Fixed #9083 -- Improved get_admin_log template tag so that it doesn't run a...

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
parent 1fcf3309
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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: