[Answer]-Formset_factory validation in django

1👍

Use Django Forms validation, define clean() method for your form class and validate fields within.

If you want to display an error for a whole form – just raise a ValidationError with proper error description.

If you want to display a field-related error (e.g. connected to the first blank field), you have to modify self._errors[field].

It’s all described in a linked part of a documentation. The example of using self._errors is at the end, in the last code snippet.

Leave a comment