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
d5410713
Commit
d5410713
authored
Aug 18, 2017
by
bugchecker
Committed by
A Connecticut Princess
Nov 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return peewee sorted columns list by default
Use in scaffold_*_columns methods
parent
94d41f7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
tools.py
flask_admin/contrib/peewee/tools.py
+2
-2
view.py
flask_admin/contrib/peewee/view.py
+5
-3
No files found.
flask_admin/contrib/peewee/tools.py
View file @
d5410713
...
...
@@ -14,8 +14,8 @@ def parse_like_term(term):
def
get_meta_fields
(
model
):
try
:
if
hasattr
(
model
.
_meta
,
'sorted_fields'
)
:
fields
=
model
.
_meta
.
sorted_fields
e
xcept
AttributeError
:
e
lse
:
fields
=
model
.
_meta
.
get_fields
()
return
fields
flask_admin/contrib/peewee/view.py
View file @
d5410713
...
...
@@ -2,7 +2,7 @@ import logging
from
flask
import
flash
from
flask_admin._compat
import
string_types
,
iteritems
from
flask_admin._compat
import
string_types
from
flask_admin.babel
import
gettext
,
ngettext
,
lazy_gettext
from
flask_admin.model
import
BaseModelView
from
flask_admin.model.form
import
create_editable_list_form
...
...
@@ -13,7 +13,7 @@ from flask_admin.actions import action
from
flask_admin.contrib.peewee
import
filters
from
.form
import
get_form
,
CustomModelConverter
,
InlineModelConverter
,
save_inline
from
.tools
import
get_primary_key
,
parse_like_term
from
.tools
import
get_
meta_fields
,
get_
primary_key
,
parse_like_term
from
.ajax
import
create_ajax_loader
# Set up logger
...
...
@@ -176,7 +176,9 @@ class ModelView(BaseModelView):
if
model
is
None
:
model
=
self
.
model
return
iteritems
(
model
.
_meta
.
fields
)
return
(
(
field
.
name
,
field
)
for
field
in
get_meta_fields
(
model
))
def
scaffold_pk
(
self
):
return
get_primary_key
(
self
.
model
)
...
...
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