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
14862cba
Commit
14862cba
authored
Jun 01, 2014
by
Sergey Markelov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*) Fixed WTForms 2.0 warning - Required is going away in WTForms 3.0, use DataRequired
parent
44f78e43
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
14 additions
and
14 deletions
+14
-14
auth.py
examples/auth-mongoengine/auth.py
+4
-4
auth.py
examples/auth/auth.py
+4
-4
simple.py
examples/forms/simple.py
+1
-1
index.py
examples/index/index.py
+1
-1
runserver.py
examples/runserver.py
+1
-1
simple.py
examples/sqla/simple.py
+1
-1
fileadmin.py
flask_admin/contrib/fileadmin.py
+1
-1
form.py
flask_admin/contrib/mongoengine/form.py
+1
-1
No files found.
examples/auth-mongoengine/auth.py
View file @
14862cba
...
@@ -46,8 +46,8 @@ class User(db.Document):
...
@@ -46,8 +46,8 @@ class User(db.Document):
# Define login and registration forms (for flask-login)
# Define login and registration forms (for flask-login)
class
LoginForm
(
form
.
Form
):
class
LoginForm
(
form
.
Form
):
login
=
fields
.
TextField
(
validators
=
[
validators
.
r
equired
()])
login
=
fields
.
TextField
(
validators
=
[
validators
.
DataR
equired
()])
password
=
fields
.
PasswordField
(
validators
=
[
validators
.
r
equired
()])
password
=
fields
.
PasswordField
(
validators
=
[
validators
.
DataR
equired
()])
def
validate_login
(
self
,
field
):
def
validate_login
(
self
,
field
):
user
=
self
.
get_user
()
user
=
self
.
get_user
()
...
@@ -63,9 +63,9 @@ class LoginForm(form.Form):
...
@@ -63,9 +63,9 @@ class LoginForm(form.Form):
class
RegistrationForm
(
form
.
Form
):
class
RegistrationForm
(
form
.
Form
):
login
=
fields
.
TextField
(
validators
=
[
validators
.
r
equired
()])
login
=
fields
.
TextField
(
validators
=
[
validators
.
DataR
equired
()])
email
=
fields
.
TextField
()
email
=
fields
.
TextField
()
password
=
fields
.
PasswordField
(
validators
=
[
validators
.
r
equired
()])
password
=
fields
.
PasswordField
(
validators
=
[
validators
.
DataR
equired
()])
def
validate_login
(
self
,
field
):
def
validate_login
(
self
,
field
):
if
User
.
objects
(
login
=
self
.
login
.
data
):
if
User
.
objects
(
login
=
self
.
login
.
data
):
...
...
examples/auth/auth.py
View file @
14862cba
...
@@ -50,8 +50,8 @@ class User(db.Model):
...
@@ -50,8 +50,8 @@ class User(db.Model):
# Define login and registration forms (for flask-login)
# Define login and registration forms (for flask-login)
class
LoginForm
(
form
.
Form
):
class
LoginForm
(
form
.
Form
):
login
=
fields
.
TextField
(
validators
=
[
validators
.
r
equired
()])
login
=
fields
.
TextField
(
validators
=
[
validators
.
DataR
equired
()])
password
=
fields
.
PasswordField
(
validators
=
[
validators
.
r
equired
()])
password
=
fields
.
PasswordField
(
validators
=
[
validators
.
DataR
equired
()])
def
validate_login
(
self
,
field
):
def
validate_login
(
self
,
field
):
user
=
self
.
get_user
()
user
=
self
.
get_user
()
...
@@ -67,9 +67,9 @@ class LoginForm(form.Form):
...
@@ -67,9 +67,9 @@ class LoginForm(form.Form):
class
RegistrationForm
(
form
.
Form
):
class
RegistrationForm
(
form
.
Form
):
login
=
fields
.
TextField
(
validators
=
[
validators
.
r
equired
()])
login
=
fields
.
TextField
(
validators
=
[
validators
.
DataR
equired
()])
email
=
fields
.
TextField
()
email
=
fields
.
TextField
()
password
=
fields
.
PasswordField
(
validators
=
[
validators
.
r
equired
()])
password
=
fields
.
PasswordField
(
validators
=
[
validators
.
DataR
equired
()])
def
validate_login
(
self
,
field
):
def
validate_login
(
self
,
field
):
if
db
.
session
.
query
(
User
)
.
filter_by
(
login
=
self
.
login
.
data
)
.
count
()
>
0
:
if
db
.
session
.
query
(
User
)
.
filter_by
(
login
=
self
.
login
.
data
)
.
count
()
>
0
:
...
...
examples/forms/simple.py
View file @
14862cba
...
@@ -249,4 +249,4 @@ if __name__ == '__main__':
...
@@ -249,4 +249,4 @@ if __name__ == '__main__':
build_sample_db
()
build_sample_db
()
# Start app
# Start app
app
.
run
(
debug
=
True
)
app
.
run
(
debug
=
True
)
\ No newline at end of file
examples/index/index.py
View file @
14862cba
...
@@ -9,4 +9,4 @@ def index():
...
@@ -9,4 +9,4 @@ def index():
return
render_template
(
'index.html'
)
return
render_template
(
'index.html'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
.
run
()
app
.
run
()
\ No newline at end of file
examples/runserver.py
View file @
14862cba
...
@@ -26,4 +26,4 @@ application = DispatcherMiddleware(
...
@@ -26,4 +26,4 @@ application = DispatcherMiddleware(
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
run_simple
(
'localhost'
,
5000
,
application
,
run_simple
(
'localhost'
,
5000
,
application
,
use_reloader
=
True
,
use_debugger
=
True
,
use_evalex
=
True
)
use_reloader
=
True
,
use_debugger
=
True
,
use_evalex
=
True
)
\ No newline at end of file
examples/sqla/simple.py
View file @
14862cba
...
@@ -122,7 +122,7 @@ class PostAdmin(sqla.ModelView):
...
@@ -122,7 +122,7 @@ class PostAdmin(sqla.ModelView):
# Pass arguments to WTForms. In this case, change label for text field to
# Pass arguments to WTForms. In this case, change label for text field to
# be 'Big Text' and add required() validator.
# be 'Big Text' and add required() validator.
form_args
=
dict
(
form_args
=
dict
(
text
=
dict
(
label
=
'Big Text'
,
validators
=
[
validators
.
r
equired
()])
text
=
dict
(
label
=
'Big Text'
,
validators
=
[
validators
.
DataR
equired
()])
)
)
form_ajax_refs
=
{
form_ajax_refs
=
{
...
...
flask_admin/contrib/fileadmin.py
View file @
14862cba
...
@@ -57,7 +57,7 @@ class UploadForm(form.BaseForm):
...
@@ -57,7 +57,7 @@ class UploadForm(form.BaseForm):
class
EditForm
(
form
.
BaseForm
):
class
EditForm
(
form
.
BaseForm
):
content
=
fields
.
TextAreaField
(
lazy_gettext
(
'Content'
),
content
=
fields
.
TextAreaField
(
lazy_gettext
(
'Content'
),
(
validators
.
r
equired
(),))
(
validators
.
DataR
equired
(),))
class
FileAdmin
(
BaseView
,
ActionsMixin
):
class
FileAdmin
(
BaseView
,
ActionsMixin
):
...
...
flask_admin/contrib/mongoengine/form.py
View file @
14862cba
...
@@ -71,7 +71,7 @@ class CustomModelConverter(orm.ModelConverter):
...
@@ -71,7 +71,7 @@ class CustomModelConverter(orm.ModelConverter):
kwargs
.
update
(
field_args
)
kwargs
.
update
(
field_args
)
if
field
.
required
:
if
field
.
required
:
kwargs
[
'validators'
]
.
append
(
validators
.
Required
())
kwargs
[
'validators'
]
.
append
(
validators
.
Data
Required
())
else
:
else
:
kwargs
[
'validators'
]
.
append
(
validators
.
Optional
())
kwargs
[
'validators'
]
.
append
(
validators
.
Optional
())
...
...
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