@@ -186,9 +186,12 @@ def render_form(self, context):
186
186
"""
187
187
uni_form.html
188
188
"""
189
- return SafeString (
190
- self .render_form_errors (context ) + self .render_form_fields (context )
191
- )
189
+ with context .push ():
190
+ context ["attrs" ] = None
191
+
192
+ return SafeString (
193
+ self .render_form_errors (context ) + self .render_form_fields (context )
194
+ )
192
195
193
196
def render_field (self , context , field , ** kwargs ):
194
197
"""
@@ -201,6 +204,7 @@ def render_field(self, context, field, **kwargs):
201
204
setattr (field_formify_helper , key , value )
202
205
203
206
with context .push ():
207
+ context ["attrs" ] = None
204
208
context ["field" ] = field
205
209
206
210
if field .is_hidden :
@@ -268,7 +272,7 @@ def render_as_tailwind_field(self, context):
268
272
field = context ["field" ]
269
273
widget = field .field .widget
270
274
271
- attrs = context .get ("attrs" , {})
275
+ attrs = context .get ("attrs" , None ) or {}
272
276
css_class = widget .attrs .get ("class" , "" )
273
277
if "class" not in attrs .keys ():
274
278
# if class is not set, then add additional css classes
@@ -296,7 +300,7 @@ def render_as_tailwind_field(self, context):
296
300
# TODO
297
301
for attribute_name , attributes in attrs .items ():
298
302
if attribute_name in widget .attrs :
299
- # multiple attribtes are in a single string, e.g.
303
+ # multiple attributes are in a single string, e.g.
300
304
# "form-control is-invalid"
301
305
for attr in attributes .split ():
302
306
if attr not in widget .attrs [attribute_name ].split ():
0 commit comments