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.
Asked
Active
Viewed 2,507 times
2 Answers
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

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

Chethan H V
- 46
- 5