Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
963bac1d
Commit
963bac1d
authored
Dec 05, 2013
by
Cosmia Luna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display foreign keys when explicitly instructed
parent
794aa776
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
form.py
flask_admin/contrib/sqla/form.py
+4
-7
No files found.
flask_admin/contrib/sqla/form.py
View file @
963bac1d
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment