I have started using django-cripsy-forms in a django project. I would like crispy to not print the tag for every form, by default. I know that I can create a helper for each form and set the helper.form_tag = False property. However, this is cumbersome to do for all the existing forms.
Does anyone know if it possible to override the default crispy settings?
I found myself in similar situation. What I come up with is a mixin for views like this one below. Still I have to add this mixin to related views, but I found it better than adding
helperto all the forms. At least I could change the default behavior for all the forms withouthelperdefined.This method only works for class-based views. If you use function-based view, you could accomplish similar behavior by adding a
prepare_formfunction and call it every time you use a form in the views.class CrispyFormsMixin(object): def get_form(self, form_class): form = super(CrispyFormsMixin, self).get_form(form_class) # Add a default helper for crispy_forms if not getattr(form, 'helper', None): form.helper = FormHelper() form.helper.form_tag = False return form