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
2c302784
Commit
2c302784
authored
Aug 27, 2013
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #298 from sumpfgottheit/inherit_pk_weak_entities
Inherit pk weak entities
parents
5202791f
8f5ff248
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
tools.py
flask_admin/contrib/sqla/tools.py
+3
-2
view.py
flask_admin/contrib/sqla/view.py
+1
-1
No files found.
flask_admin/contrib/sqla/tools.py
View file @
2c302784
...
@@ -51,8 +51,9 @@ def is_inherited_primary_key(prop):
...
@@ -51,8 +51,9 @@ def is_inherited_primary_key(prop):
:return: Boolean
:return: Boolean
:raises: Exceptions as they occur - no ExceptionHandling here
:raises: Exceptions as they occur - no ExceptionHandling here
"""
"""
return
(
len
([
column
for
column
in
prop
.
columns
if
column
.
primary_key
])
==
len
(
prop
.
columns
)
and
if
prop
.
expression
.
primary_key
:
len
([
column
for
column
in
prop
.
columns
if
column
.
foreign_keys
])
==
len
(
prop
.
columns
)
-
1
)
return
len
(
prop
.
_orig_columns
)
==
len
(
prop
.
columns
)
-
1
return
False
def
get_column_for_current_model
(
prop
):
def
get_column_for_current_model
(
prop
):
"""
"""
...
...
flask_admin/contrib/sqla/view.py
View file @
2c302784
...
@@ -323,7 +323,7 @@ class ModelView(BaseModelView):
...
@@ -323,7 +323,7 @@ class ModelView(BaseModelView):
if
is_inherited_primary_key
(
p
):
if
is_inherited_primary_key
(
p
):
column
=
get_column_for_current_model
(
p
)
column
=
get_column_for_current_model
(
p
)
else
:
else
:
raise
TypeError
(
'Can not convert multiple-column properties (
%
s.
%
s)'
%
(
model
,
p
.
key
))
raise
TypeError
(
'Can not convert multiple-column properties (
%
s.
%
s)'
%
(
self
.
model
,
p
.
key
))
else
:
else
:
# Grab column
# Grab column
column
=
p
.
columns
[
0
]
column
=
p
.
columns
[
0
]
...
...
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