django-forms
Installation
SKILL.md
Django Forms
Philosophy
- Prefer ModelForm for model-backed forms
- Keep validation logic in forms, not views
- Always handle and display form errors
- Use
commit=Falsewhen you need to modify the instance before saving
Validation
Field-level (clean_<field>):
- Validate and transform a single field
- Return the cleaned value or raise
ValidationError - Use for: format checks, uniqueness, normalization