Show Menu
Cheatography

django form Cheat Sheet (DRAFT) by

Django Forms

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Django Forms

Create a forms.py file in Django applic­ation’s directory to store form-r­elated classes
Create a ModelForm class for each model that you wish to represent as a form
Customise the forms as you desire
Create or update a view to handle the form - including displaying the form, saving the form data, and flagging up errors which may occur when the user enters incorrect data (or no data at all) in the form
Create or update a template to display the form
Add a urlpattern to map to the new view (if you created a new one)
How to use django forms