1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.8.x] Fixed #24851 -- Fixed crash with reverse one-to-one relation in ModelAdmin.list_display

This commit is contained in:
Tim Graham
2015-05-27 11:43:22 -04:00
parent f65d4db8a8
commit 2456276b02
6 changed files with 18 additions and 6 deletions

View File

@@ -200,7 +200,7 @@ def items_for_result(cl, result, form):
except ObjectDoesNotExist:
result_repr = EMPTY_CHANGELIST_VALUE
else:
if f is None:
if f is None or f.auto_created:
if field_name == 'action_checkbox':
row_classes = ['action-checkbox']
allow_tags = getattr(attr, 'allow_tags', False)

View File

@@ -383,7 +383,7 @@ class ChangeList(object):
except FieldDoesNotExist:
pass
else:
if isinstance(field.rel, models.ManyToOneRel):
if hasattr(field, 'rel') and isinstance(field.rel, models.ManyToOneRel):
return True
return False