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 @@