Fah Nateecha
Fah Nateecha

Reputation: 161

What is the DEFAULT maximum length of TextField Django?

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.

Upvotes: 4

Views: 4621

Answers (2)

Chethan H V
Chethan H V

Reputation: 46

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

Upvotes: 0

JPG
JPG

Reputation: 88469

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

Upvotes: 8

Related Questions