Django Form | Data Types and Fields
Last Updated :
23 Jul, 2025
When collecting user input in Django, forms play a crucial role in validating and processing the data before saving it to the database. Django provides a rich set of built-in form field types that correspond to different kinds of input, making it easy to build complex forms quickly.
Each form field type comes with its own validation logic and widget (HTML input type) to help gather and verify user data efficiently.
To master form handling and other Django functionalities, you can check Django Web Development Course.
Here is a summary of commonly used Django form fields, their purposes, and their default widgets:
BooleanField Represents a checkbox that stores True or False.
Default widget: CheckboxInput
Syntax:
field_name = forms.BooleanField(**options)
CharField Used for short to medium text inputs.
Default widget: TextInput
Syntax:
field_name = forms.CharField(**options)
ChoiceField lets users select one option from a predefined list.
Default widget: Select
Syntax:
field_name = forms.ChoiceField(**options)
DateField in Django Forms is a date field, for taking input of dates from the user.
Default widget: DateInput
Syntax:
field_name = forms.DateField(**options)
DateTimeField in Django Forms is a date field, for taking input of date and time from the user.
Default widget: DateTimeInput
Syntax:
field_name = forms.DateTimeField(**options)
DecimalField in Django Forms is a decimal field, for input of decimal numbers.
Default widget: NumberInput
Syntax:
field_name = forms.DecimalField(**options)
DurationField in Django Forms is used for input of particular durations for example from 12 am to 1 pm.
Default widget: TextInput
Syntax:
field_name = forms.DurationField(**options)
EmailField in Django Forms is a string field, for input of Emails. It is used for taking text inputs from the user.
Default widget: EmailInput
Syntax:
field_name = forms.EmailField(**options)
FileField in Django Forms is an input field for the upload of files.
Default widget: ClearableFileInput
Syntax:
field_name = forms.FileField(**options)
FilePathField selects a file path from the server.
Default widget: Select
Syntax:
field_name = forms.FilePathField(**options)
FloatField in Django Forms is an integer field, for taking input of floating point numbers from the user.
Default widget: NumberInput
Syntax:
field_name = forms.FloatField(**options)
GenericIPAddressField in Django Forms is a text field, for input of IP Addresses. It is a field containing either an IPv4 or an IPv6 address.
Default widget: TextInput
Syntax:
field_name = forms.GenericIPAddressField(**options)
ImageField in Django Forms is an input field for the upload of image files.
Default widget: ClearableFileInput
Syntax:
field_name = forms.ImageField(**options)
IntegerField in Django Forms is an integer field, for the input of Integer numbers.
Default widget: NumberInput
Syntax:
field_name = forms.IntegerField(**options)
MultipleChoiceField in Django Forms is a Choice field, for input of multiple pairs of values from a field.
Default widget: SelectMultiple
Syntax:
field_name = forms.MultipleChoiceField(**options)
NullBooleanField in Django Forms is a select field that stores either True or False. It is used for taking boolean inputs from the user.
Default widget: NullBooleanSelect
Syntax:
field_name = forms.NullBooleanField(**options)
RegexField in Django Forms is a string field, for small- to large-sized strings that one can match with a particular regular expression. It is used for taking selected text inputs from the user.
Default widget: TextInput
Syntax:
field_name = forms.RegexField(**options)
SlugField in Django Forms is a slug field, for input of slugs for particular URLs or similar. This field is intended for use in representing a model SlugField in forms.
Default widget: TextInput
Syntax:
field_name = forms.SlugField(**options)
TimeField in Django Forms is a time input field, for input of time for a particular instance or similar.
Default widget: TimeInput
Syntax:
field_name = forms.TimeField(**options)
TypedChoiceField in Django Forms is a field just like ChoiceField, for selecting a particular choice out of a list of available choices. It is used to implement State, Countries etc.
Default widget: Select
Syntax:
field_name = forms.TypedChoiceField(**options)
TypedMultipleChoiceField in Django Forms is a Choice field, for input of multiple pairs of values from a field and it includes a coerce function also to convert data into specific data types.
Default widget: SelectMultiple
Syntax:
field_name = forms.TypedMultipleChoiceField(**options)
URLField in Django Forms is a URL field, for the input of URLs from a user. This field is intended for use in representing a model URLField in forms.
Default widget: URLInput
Syntax
field_name = forms.URLField(**options)
UUIDField in Django Forms is a UUID field, for the input of UUIDs from a user.
Default widget: TextInput
Syntax:
field_name = forms.UUIDField(**options)
Read Next: Initial form data – Django Forms
Explore
Python Fundamentals
Python Data Structures
Advanced Python
Data Science with Python
Web Development with Python
Python Practice
My Profile