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
87abc575
Commit
87abc575
authored
Sep 17, 2012
by
Peter Ward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support not nullable boolean fields, and fix filtering by boolean fields.
parent
ff887bd7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
2 deletions
+4
-2
AUTHORS
AUTHORS
+1
-0
form.py
flask_admin/contrib/sqlamodel/form.py
+2
-1
filters.py
flask_admin/model/filters.py
+1
-1
No files found.
AUTHORS
View file @
87abc575
...
...
@@ -15,3 +15,4 @@ Patches and Suggestions
- Salem Harrache <salem@harrache.info>
- F. Gabriel Gosselin
- Leonardinius <leonids.maslovs@galeoconsulting.com>
- Peter Ward <peteraward@gmail.com>
flask_admin/contrib/sqlamodel/form.py
View file @
87abc575
from
wtforms
import
fields
,
validators
from
sqlalchemy
import
Boolean
from
flask.ext.admin
import
form
from
flask.ext.admin.model.form
import
converts
,
ModelConverterBase
,
InlineFormAdmin
...
...
@@ -125,7 +126,7 @@ class AdminModelConverter(ModelConverterBase):
model
,
column
))
if
not
column
.
nullable
:
if
not
column
.
nullable
and
not
isinstance
(
column
.
type
,
Boolean
):
kwargs
[
'validators'
]
.
append
(
validators
.
Required
())
# Apply label
...
...
flask_admin/model/filters.py
View file @
87abc575
...
...
@@ -77,7 +77,7 @@ class BaseBooleanFilter(BaseFilter):
"""
Base boolean filter, uses fixed list of options.
"""
def
__init__
(
self
,
name
,
data_type
=
None
):
def
__init__
(
self
,
name
,
options
=
None
,
data_type
=
None
):
super
(
BaseBooleanFilter
,
self
)
.
__init__
(
name
,
((
'1'
,
lazy_gettext
(
'Yes'
)),
(
'0'
,
lazy_gettext
(
'No'
))),
...
...
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