Skip to content

Commit

Permalink
WTForms DeprecationWarning: Flags should be stored in dicts and not i…
Browse files Browse the repository at this point in the history
…n tuples. The next version of WTForms will abandon support for flags in tuples.
  • Loading branch information
mccarthysean committed Jan 5, 2024
1 parent 99fcebf commit 4e0802f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Unique(object):
:param message:
The error message.
"""
field_flags = ('unique', )
field_flags = {'unique': True}

def __init__(self, db_session, model, column, message=None):
self.db_session = db_session
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class FieldListInputRequired(object):
Validates that at least one item was provided for a FieldList
"""

field_flags = ('required',)
field_flags = {'required': True}

def __call__(self, form, field):
if len(field.entries) == 0:
Expand Down
2 changes: 1 addition & 1 deletion flask_admin/contrib/sqla/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Unique(object):
:param message:
The error message.
"""
field_flags = ('unique', )
field_flags = {'unique': True}

def __init__(self, db_session, model, column, message=None):
self.db_session = db_session
Expand Down
2 changes: 1 addition & 1 deletion flask_admin/form/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class FieldListInputRequired(object):
Validates that at least one item was provided for a FieldList
"""

field_flags = ('required',)
field_flags = {'required': True}

def __call__(self, form, field):
if len(field.entries) == 0:
Expand Down

0 comments on commit 4e0802f

Please sign in to comment.