Skip to content

Commit f1e8167

Browse files
committed
Fix dictionary AttributeError
1 parent 6b584a4 commit f1e8167

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

flask_mongoengine/documents.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,16 @@ def to_wtf_form(
135135
to construct each field object.
136136
"""
137137
form_fields_dict = {}
138+
field_args = field_args or {}
138139
fields_names = cls._get_fields_names(only, exclude)
139140

140141
for field_name in fields_names:
141142
# noinspection PyUnresolvedReferences
142143
field_class = cls._fields[field_name]
143144
try:
144145
form_fields_dict[field_name] = field_class.to_wtf_field(
145-
field_args.get(field_name)
146+
cls,
147+
field_args.get(field_name),
146148
)
147149
except AttributeError:
148150
logger.warning(

0 commit comments

Comments
 (0)