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
7d483ccb
Commit
7d483ccb
authored
Sep 17, 2012
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #61 from flowblok/master
Fixes for boolean fields
parents
ff887bd7
87abc575
Changes
3
Hide 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 @
7d483ccb
...
@@ -15,3 +15,4 @@ Patches and Suggestions
...
@@ -15,3 +15,4 @@ Patches and Suggestions
- Salem Harrache <salem@harrache.info>
- Salem Harrache <salem@harrache.info>
- F. Gabriel Gosselin
- F. Gabriel Gosselin
- Leonardinius <leonids.maslovs@galeoconsulting.com>
- Leonardinius <leonids.maslovs@galeoconsulting.com>
- Peter Ward <peteraward@gmail.com>
flask_admin/contrib/sqlamodel/form.py
View file @
7d483ccb
from
wtforms
import
fields
,
validators
from
wtforms
import
fields
,
validators
from
sqlalchemy
import
Boolean
from
flask.ext.admin
import
form
from
flask.ext.admin
import
form
from
flask.ext.admin.model.form
import
converts
,
ModelConverterBase
,
InlineFormAdmin
from
flask.ext.admin.model.form
import
converts
,
ModelConverterBase
,
InlineFormAdmin
...
@@ -125,7 +126,7 @@ class AdminModelConverter(ModelConverterBase):
...
@@ -125,7 +126,7 @@ class AdminModelConverter(ModelConverterBase):
model
,
model
,
column
))
column
))
if
not
column
.
nullable
:
if
not
column
.
nullable
and
not
isinstance
(
column
.
type
,
Boolean
):
kwargs
[
'validators'
]
.
append
(
validators
.
Required
())
kwargs
[
'validators'
]
.
append
(
validators
.
Required
())
# Apply label
# Apply label
...
...
flask_admin/model/filters.py
View file @
7d483ccb
...
@@ -77,7 +77,7 @@ class BaseBooleanFilter(BaseFilter):
...
@@ -77,7 +77,7 @@ class BaseBooleanFilter(BaseFilter):
"""
"""
Base boolean filter, uses fixed list of options.
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
,
super
(
BaseBooleanFilter
,
self
)
.
__init__
(
name
,
((
'1'
,
lazy_gettext
(
'Yes'
)),
((
'1'
,
lazy_gettext
(
'Yes'
)),
(
'0'
,
lazy_gettext
(
'No'
))),
(
'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