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
7c949674
Commit
7c949674
authored
Oct 27, 2015
by
Paul Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent validators from getting inserted twice
parent
10680598
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
form.py
flask_admin/contrib/mongoengine/form.py
+4
-1
form.py
flask_admin/contrib/sqla/form.py
+4
-1
No files found.
flask_admin/contrib/mongoengine/form.py
View file @
7c949674
from
copy
import
deepcopy
from
mongoengine
import
ReferenceField
,
ListField
from
mongoengine.base
import
BaseDocument
,
DocumentMetaclass
,
get_document
...
...
@@ -68,7 +70,8 @@ class CustomModelConverter(orm.ModelConverter):
}
if
field_args
:
kwargs
.
update
(
field_args
)
# prevent modification of self.form_args
kwargs
.
update
(
deepcopy
(
field_args
))
if
field
.
required
:
kwargs
[
'validators'
]
.
append
(
validators
.
InputRequired
())
...
...
flask_admin/contrib/sqla/form.py
View file @
7c949674
import
warnings
from
copy
import
deepcopy
from
wtforms
import
fields
,
validators
from
sqlalchemy
import
Boolean
,
Column
...
...
@@ -147,7 +149,8 @@ class AdminModelConverter(ModelConverterBase):
}
if
field_args
:
kwargs
.
update
(
field_args
)
# prevent modification of self.form_args
kwargs
.
update
(
deepcopy
(
field_args
))
# Check if it is relation or property
if
hasattr
(
prop
,
'direction'
):
...
...
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