diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2008-09-16 05:50:03 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2008-09-16 05:50:03 +0000 |
| commit | af23d8d3b38270f58404c002942bcc200f1855bf (patch) | |
| tree | 0666f553257e65963e4f8b60895c729edfb17a6b | |
| parent | 1fcf33095fcdafe985cfbb45780e094e0aeb2374 (diff) | |
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
| -rw-r--r-- | django/contrib/admin/templatetags/log.py | 4 |
1 files 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: |
