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
This commit is contained in:
Malcolm Tredinnick 2007-05-08 03:56:44 +00:00
parent af846c0b8b
commit d1b0d34dc6
2 changed files with 7 additions and 3 deletions

View File

@ -70,6 +70,7 @@ answer newbie questions, and generally made Django that much better:
Amit Chakradeo <http://amit.chakradeo.net/> Amit Chakradeo <http://amit.chakradeo.net/>
ChaosKCW ChaosKCW
ivan.chelubeev@gmail.com ivan.chelubeev@gmail.com
Bryan Chow <bryan at verdjn dot com>
Ian Clelland <clelland@gmail.com> Ian Clelland <clelland@gmail.com>
crankycoder@gmail.com crankycoder@gmail.com
Matt Croydon <http://www.postneo.com/> Matt Croydon <http://www.postneo.com/>

View File

@ -11,7 +11,10 @@ class AdminLogNode(template.Node):
return "<GetAdminLog Node>" return "<GetAdminLog Node>"
def render(self, context): def render(self, context):
if self.user is not None and not self.user.isdigit(): 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 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()[:self.limit]
return '' return ''