From d1b0d34dc67941ce7c285c29d3f4031954c20283 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Tue, 8 May 2007 03:56:44 +0000 Subject: [PATCH] Fixed #4200 -- Made get_admin_log template tag behave according to its docstring (user specifier is optional). Thanks, Bryan Chow. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5170 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- AUTHORS | 1 + django/contrib/admin/templatetags/log.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 841f046982..fb2d5f7112 100644 --- a/AUTHORS +++ b/AUTHORS @@ -70,6 +70,7 @@ answer newbie questions, and generally made Django that much better: Amit Chakradeo ChaosKCW ivan.chelubeev@gmail.com + Bryan Chow Ian Clelland crankycoder@gmail.com Matt Croydon diff --git a/django/contrib/admin/templatetags/log.py b/django/contrib/admin/templatetags/log.py index 5caba2b795..8d52d2e944 100644 --- a/django/contrib/admin/templatetags/log.py +++ b/django/contrib/admin/templatetags/log.py @@ -11,9 +11,12 @@ class AdminLogNode(template.Node): return "" def render(self, context): - if self.user is not None and 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] + if self.user is None: + context[self.varname] = LogEntry.objects.all().select_related()[: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] return '' class DoGetAdminLog: