Fixed #14935 -- Corrected a test failure introduced by r14992, which revealed an unhandled edge case in LogEntry handling in the admin. Thanks to Ramiro Morales for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15024 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2010-12-22 16:24:30 +00:00
parent 3550456535
commit df4cb60004
2 changed files with 4 additions and 2 deletions

View File

@ -51,4 +51,6 @@ class LogEntry(models.Model):
Returns the admin URL to edit the object represented by this log entry.
This is relative to the Django admin index page.
"""
return mark_safe(u"%s/%s/%s/" % (self.content_type.app_label, self.content_type.model, quote(self.object_id)))
if self.content_type and self.object_id:
return mark_safe(u"%s/%s/%s/" % (self.content_type.app_label, self.content_type.model, quote(self.object_id)))
return None

View File

@ -60,7 +60,7 @@
<ul class="actionlist">
{% for entry in admin_log %}
<li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">
{% if entry.is_deletion %}
{% if entry.is_deletion or not entry.get_admin_url %}
{{ entry.object_repr }}
{% else %}
<a href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>