
A product form restates every model field by hand, so it drifts from the model and the model's own rules never reach it. Derive the form from the model with Meta, give the declared fields their widgets and labels, and save through the form with commit=False so the view can stamp the server-set listing code.
Read the full problemA duplicate slug reaches the database instead of coming back as a form error, and editing a page false-positives against its own slug. Layer the slug rules and a self-excluding uniqueness check on the ModelForm, with a unique constraint on the model as the backstop.
Read the full problemRegistering a group one attendee at a time leaves half the group saved when a row fails. Handle the whole group as one formset submission: a fixed number of rows, a delete box per saved row, validation across every row before anything is written, and an all-or-nothing save.
Read the full problemAn invoice is a header plus a growable table of lines, and a single form cannot take both or keep them consistent. Build the editor from a header ModelForm and an inline item formset bound to the parent, layer field, form and cross-formset rules over it, and save parent and children together inside one transaction.
Read the full problem