mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #26085 -- Fixed contenttypes shortcut() view crash with a null fk to Site.
Thanks Fabien Schwob for the initial patch.
This commit is contained in:
@@ -63,9 +63,11 @@ def shortcut(request, content_type_id, object_id):
|
||||
for field in obj._meta.fields:
|
||||
if field.remote_field and field.remote_field.model is Site:
|
||||
try:
|
||||
object_domain = getattr(obj, field.name).domain
|
||||
site = getattr(obj, field.name)
|
||||
except Site.DoesNotExist:
|
||||
pass
|
||||
continue
|
||||
if site is not None:
|
||||
object_domain = site.domain
|
||||
if object_domain is not None:
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user