Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit df4cb60004db5cbbe402233138f2f0c804a46f15 1 parent 3550456
@freakboy3742 freakboy3742 authored
View
4 django/contrib/admin/models.py
@@ -51,4 +51,6 @@ def get_admin_url(self):
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
2  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>
Please sign in to comment.
Something went wrong with that request. Please try again.