summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-12-22 16:24:30 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-12-22 16:24:30 +0000
commitdf4cb60004db5cbbe402233138f2f0c804a46f15 (patch)
treed29891ff8d4035b8e36727485d8b06f726855586
parent355045653587114fc48011e7071337df5c94c80b (diff)
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
-rw-r--r--django/contrib/admin/models.py4
-rw-r--r--django/contrib/admin/templates/admin/index.html2
2 files changed, 4 insertions, 2 deletions
diff --git a/django/contrib/admin/models.py b/django/contrib/admin/models.py
index 259884faba..73810b7399 100644
--- a/django/contrib/admin/models.py
+++ b/django/contrib/admin/models.py
@@ -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 \ No newline at end of file
diff --git a/django/contrib/admin/templates/admin/index.html b/django/contrib/admin/templates/admin/index.html
index 772474bea5..d392f075ad 100644
--- a/django/contrib/admin/templates/admin/index.html
+++ b/django/contrib/admin/templates/admin/index.html
@@ -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>