Using form fields
Similar to the standard model field classes introduced in Chapter 3, Models, Relations, and Inheritance, Django also provides a number of form field classes that are available to use. The difference is that a model field class works with the columns of a database and a form field class is used only as an input field within an HTML <form></form>
object in a template.
The following table can be used as a cheat sheet to reference what fields are available when writing your Form
and/or ModelForm
classes:
Form fields also accept a variety of different field arguments that customize the behavior of each field. In the next section, we will use some of the field types in the preceding list to write fields on our form classes, discussing the different arguments that can be used.
For a complete breakdown of each of these field types, visit the official Django documentation on field classes and arguments, found here: https://docs...