-
Book Overview & Buying
-
Table Of Contents
Django Design Patterns and Best Practices - Second Edition
By :
Forms can be tricky to understand because interacting with them takes more than one request-response cycle. In the simplest scenario, you need to present an empty form, which the user then fills in correctly and submits. Conversely, they might enter some invalid data, in which case the form needs to be resubmitted until the entire form is valid.
From this scenario, we can see that a form can be one of several states, changing between them:
The users will never see the form in the submitted form without errors state. They don't have to. Typically, submitting a valid form should take the users to a success page.
Django's form class instances contain the state of each field and, by...
Change the font size
Change margin width
Change background colour