What is the difference between null=True and blank=True in Django?

When we add a model field in Django we generally write:

models.CharField(max_length=100, null=True, blank=True)

The same is done with ForeignKey, DecimalField etc. What is the basic difference between:

  1. null=True only
  2. blank=True only
  3. null=True and blank=True

in respect to different (CharField, ForeignKey, ManyToManyField, DateTimeField) fields? What are the advantages/disadvantages of using option 1, 2, or 3?

← Назад к списку