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

Fixed #26060 -- Fixed crash with reverse OneToOneField in ModelAdmin.readonly_fields.

This commit is contained in:
Alexander Gaevsky
2016-01-09 22:15:21 +02:00
committed by Tim Graham
parent fb4272f0e6
commit 9a33d3d764
6 changed files with 87 additions and 13 deletions

View File

@@ -383,7 +383,7 @@ def help_text_for_field(name, model):
def display_for_field(value, field, empty_value_display):
from django.contrib.admin.templatetags.admin_list import _boolean_icon
if field.flatchoices:
if getattr(field, 'flatchoices', None):
return dict(field.flatchoices).get(value, empty_value_display)
# NullBooleanField needs special-case null-handling, so it comes
# before the general null test.