DEV Community

Discussion on: Django inline formsets with Class-based views and crispy forms

Collapse
 
mustafamond profile image
Mustafamond • Edited

This was a great post and easy to follow - did exactly what I needed. However, I am having a problem on the validation side. I am unable to get any validation errors to show up on fields in the the formset. If the data in any field in the formset is not valid (forms.ValidationError raised using the form's clean method), or if the formset itself is not valid (for example, unique_together violated in the rows to be added), the overall form still posts and is the data is saved to the database, but the formset is simply ignored - nothing is saved and the form never chows the errors and the user never has a chance to correct any incorrect data.

Validation works correctly on the main form, just not the formset inserted using the Crispy layouts.

Any hints on how to get validation errors to cause the form to display the errors for the formset and subform during the post would be greatly appreciated.

Thanks for the great post!