crispy form wouldn't show form level errors

268 views
Skip to first unread message

Subodh Nijsure

unread,
Oct 4, 2014, 8:07:05 AM10/4/14
to django...@googlegroups.com
I have a form that clearly form level errors (not field level) I can
print those error messages in my form_invalid method.

But they are not showing up when using crispy form.

I have set following options

self.helper.form_error_title = "Form Errors"
self.helper.form_show_errors = True


( http://django-crispy-forms.readthedocs.org/en/latest/form_helper.html#bootstrap-helper-attributes
)

I can display them by passing form_errors in context as:

context['form_errors'] = form.errors

And show them in my template using

<div id='form-errors'>{{ form_errors }}</div>

But I can't get crispy form to natively show form level errors. What
options do I have to set so crispy form will display form level errors
correctly?

-Subodh

Collin Anderson

unread,
Oct 4, 2014, 1:17:42 PM10/4/14
to django...@googlegroups.com
try this if you haven't:
{{ form.non_field_errors }}

Subodh Nijsure

unread,
Oct 4, 2014, 2:47:40 PM10/4/14
to django...@googlegroups.com

I have tried that in my fom_invalid method it has valid messages but crispy firm is not picking it up. But if I just try to print them in template  it is empty so it's getting reset between fom_invalid and template rendering?

Subodh

On Oct 4, 2014 10:18 AM, "Collin Anderson" <cmawe...@gmail.com> wrote:
try this if you haven't:
{{ form.non_field_errors }}

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cd50882e-03c8-4295-9b91-98c24c29f84b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages