﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
19219	Admin Templatetag log.py - context[self.user] is not an object	scovetta	nobody	"I've recently upgraded to Django 1.4.2 and noticed that the Admin app is broken. Specifically, I am getting:
{{{
AttributeError: 'dict' object has no attribute 'id'
}}}

This is coming from:

{{{
# django/contrib/admin/templatetags/log.py
13	    def render(self, context):
14	        if self.user is None:
15	            context[self.varname] = LogEntry.objects.all().select_related('content_type', 'user')[:self.limit]
16	        else:
17	            user_id = self.user
18	            if not user_id.isdigit():
19				user_id = context[self.user].id
}}}

I am using some third-party components (Nexus and Django-Extensions, notably), but this looks like a bug within Django.

The context[self.user] variable is a dictionary, containing, a __dict__'ed User:
{{{
{'username': u'scovetta', 'first_name': u'', 'last_name': u'', 'is_active': True, '_state': <django.db.models.base.ModelState object at 0x104681c50>, 'email': u'', 'is_superuser': True, 'is_staff': True, 'last_login': datetime.datetime(2012, 10, 31, 11, 26, 53, 488934), 'password': u'(removed)' , 'id': 2, 'date_joined': datetime.datetime(2012, 8, 3, 8, 8, 59, 69517)  }
}}}

I've attached a patch for this."	Bug	closed	contrib.admin	1.4	Normal	invalid		scovetta	Unreviewed	1	0	0	0	1	0
