Day 17 of 100 Days of Django: Built-in Model Field Types in Django.

Aman Khan
2 min readJul 28, 2022

--

Hi Dev’s👏, Let see some Mostly used Field Types by Django Developers.

Django ships with dozens of built in filed types which can be used to save any type of data from number to entire HTML file📃 too. Here is list Field types used in Django.

Model Data types and Field list📝

  • AutoField → It is an integer field that automatically increments.Generally used as ID.
  • BigAutoField → It is a 64-bit integer, much like an AutoField except that it is guaranteed to fit numbers from 1 to 9223372036854775807.
  • BinaryField → A field to store raw binary data.
  • BooleanField → A true/false field. The default form widget for this field is a CheckboxInput.
  • CharField📄 → A field to store text-based values.
  • DateField📅 → A date, represented in Python by a datetime.date instance
  • DateTimeField📅⌚ → It is used for date and time, represented in Python by a datetime.datetime instance.
  • DurationField → A field for storing periods of time.
  • EmailField📨 → It is a CharField that checks that the value is a valid email address.
  • FileField📁 → It is a file-upload field.
  • ImageField🙅‍♀️ → It inherits all attributes and methods from FileField, but also validates that the uploaded object is a valid image.
  • IntegerField → It is an integer field. Values from -2147483648 to 2147483647 are safe in all databases supported by Django.
  • GenericIPAdressField → An IPv4 or IPv6 address, in string format (e.g. 192.0.2.30 or 2a02:42fe::4).
  • SlugField → Slug is a newspaper term. A slug is a short label for something, containing only letters, numbers, underscores or hyphens. They’re generally used in URLs.
  • TextField → A large text field. The default form widget for this field is a Textarea.
  • TimeField⌚ → A time, represented in Python by a datetime.time instance.
  • URLField → A CharField for a URL, validated by URLValidator.
  • UUIDField → A field for storing universally unique identifiers. Uses Python’s UUID class. When used on PostgreSQL, this stores in a uuid datatype, otherwise in a char(32).

In the Next Article we are going to see Retrieve and Display Data from Backend😁, So Stay tuned.

Thanks for Following and Claps😋

Link to Day 18

Link to Starter Page

--

--

Aman Khan

Blockchain and Web3 Engineer Crafting compelling stories at the intersection of tech, business, and culture.