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
This commit is contained in:
parent
1fcf33095f
commit
af23d8d3b3
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue