0PricingLogin
Django Academy · Lesson

Choosing Field Types

CharField, TextField, IntegerField, and friends.

Pick the Right Field

Each column needs a field type that matches its data. Choosing well keeps your database tidy and your validation automatic.

CharField for Short Text

Use CharField for short strings like names or titles. It always needs a max_length to size the column.

title = models.CharField(max_length=200)

All lessons in this course

  1. Defining a Model Class
  2. Choosing Field Types
  3. Field Options: null, blank, default
  4. str and the Meta Class
← Back to Django Academy