Skip to content
Justice Tech School

Field Types

Common fields include CharField, IntegerField, BooleanField and DateField.

Example
class Item(models.Model):
    name = models.CharField(max_length=50)
    qty = models.IntegerField(default=0)
    active = models.BooleanField(default=True)
    price = models.DecimalField(max_digits=8, decimal_places=2)

Exercise

Yes or no field.

models.Field()

Quiz Test

Which field needs max_length?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.