Django Model Field Reference CharField

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!


The CharField is used for storing defined lengths of text. In the example below up to 128 characters of text can be stored in the field. Entering a string longer than this will result in a validation error being raised.

from django.db import models

class MyModel(models.Model):
    name = models.CharField(max_length=128, blank=True)

Got any Django Question?