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
18b3c956
Commit
18b3c956
authored
Mar 22, 2012
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation for new widgets.
parent
b6206e20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
form.py
flask_adminex/form.py
+22
-1
No files found.
flask_adminex/form.py
View file @
18b3c956
...
...
@@ -25,7 +25,8 @@ class AdminForm(wtf.Form):
class
TimeField
(
fields
.
Field
):
"""
A text field which stores a `datetime.time` matching a format.
A text field which stores a `datetime.time` object.
Accepts time string in multiple formats: 20:10, 20:10:00, 10:00 am, 9:30pm, etc.
"""
widget
=
widgets
.
TextInput
()
...
...
@@ -72,6 +73,11 @@ class TimeField(fields.Field):
class
ChosenSelectWidget
(
widgets
.
Select
):
"""
`Chosen <http://harvesthq.github.com/chosen/>`_ styled select widget.
You must include chosen.js and form.js for styling to work.
"""
def
__call__
(
self
,
field
,
**
kwargs
):
if
field
.
allow_blank
and
not
self
.
multiple
:
kwargs
[
'data-role'
]
=
u'chosenblank'
...
...
@@ -82,16 +88,31 @@ class ChosenSelectWidget(widgets.Select):
class
ChosenSelectField
(
fields
.
SelectField
):
"""
`Chosen <http://harvesthq.github.com/chosen/>`_ styled select field.
You must include chosen.js and form.js for styling to work.
"""
widget
=
ChosenSelectWidget
class
DatePickerWidget
(
widgets
.
TextInput
):
"""
Date picker widget.
You must include bootstrap-datepicker.js and form.js for styling to work.
"""
def
__call__
(
self
,
field
,
**
kwargs
):
kwargs
[
'data-role'
]
=
u'datepicker'
return
super
(
DatePickerWidget
,
self
)
.
__call__
(
field
,
**
kwargs
)
class
DateTimePickerWidget
(
widgets
.
TextInput
):
"""
Datetime picker widget.
You must include bootstrap-datepicker.js and form.js for styling to work.
"""
def
__call__
(
self
,
field
,
**
kwargs
):
kwargs
[
'data-role'
]
=
u'datetimepicker'
return
super
(
DateTimePickerWidget
,
self
)
.
__call__
(
field
,
**
kwargs
)
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