diff options
| -rw-r--r-- | django/contrib/admin/models.py | 4 | ||||
| -rw-r--r-- | django/contrib/admin/templates/admin/index.html | 2 |
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> |
