Commit 963bac1d authored by Cosmia Luna's avatar Cosmia Luna

Display foreign keys when explicitly instructed

parent 794aa776
...@@ -156,8 +156,10 @@ class AdminModelConverter(ModelConverterBase): ...@@ -156,8 +156,10 @@ class AdminModelConverter(ModelConverterBase):
# Grab column # Grab column
column = prop.columns[0] column = prop.columns[0]
# Do not display foreign keys - use relations form_columns = getattr(self.view, 'form_columns', None) or ()
if column.foreign_keys:
# Do not display foreign keys - use relations, except when explicitly instructed
if column.foreign_keys and prop.key not in form_columns:
return None return None
# Only display "real" columns # Only display "real" columns
...@@ -172,11 +174,6 @@ class AdminModelConverter(ModelConverterBase): ...@@ -172,11 +174,6 @@ class AdminModelConverter(ModelConverterBase):
return fields.HiddenField() return fields.HiddenField()
else: else:
# By default, don't show primary keys either # By default, don't show primary keys either
form_columns = getattr(self.view, 'form_columns', None)
if form_columns is None:
return None
# If PK is not explicitly allowed, ignore it # If PK is not explicitly allowed, ignore it
if prop.key not in form_columns: if prop.key not in form_columns:
return None return None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment