How to set django formsets _all_ error from view? -


description :

okay, formset set of forms. have number, or form number , compare summed number forms formset. that's why part of validation in view. , if numbers don't match want set error , not specific form in formset, formsets all errors.

i have no problem setting ordinary forms error view :

form.errors['__all__'] = form.error_class(["here error"]) 

but how assign all error formset, , possible, or have assign error forms within formset ?

formsets have errors attribute works identically form.errors.

however, sounds you're trying validation in view. should add custom validation formset using clean method, , raise forms.validationerror when user input invalid. see django formset documentation.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -