3

I want to know what is the maximum length of TextField in Django models. I know they cannot limit maximum length but I want to know the real maximum length of the TextField type. Please help me solve this question.

Fah Nateecha
  • 151
  • 3
  • 14

2 Answers2

5

The models.TextField(...)'s maximum size purely relies on the database you are using. If you are using MYSQL, it uses the longtext data type to store the content, which can hold up to 4 Gigabytes

Ref: Maximum length for MySQL type text

JPG
  • 82,442
  • 19
  • 127
  • 206
0

The Django DB Docs will tell you, that max_length=255 is guaranteed to work always (for CharField() not TextField()). If you need something of the amount you've specified in your question, I'd suggest to use a TextField. It depends on the backend database. If you use MySQL 5.6 then there is a limit of 65,535

David Mason
  • 2,917
  • 4
  • 30
  • 45