hguochen
hguochen

Reputation: 168

How does django interpret CommaSeparatedIntegerField 'max_length' field option?

In django model types, models.CommaSeparatedIntegerField consists of a field of integers separated by commas with a required max_length field option.

If i have max_length=30, does it mean i can store 30 integers separated by commas or it's the entire string input that must be within 30 characters?

Upvotes: 1

Views: 465

Answers (1)

DiA
DiA

Reputation: 369

It's mean that you can entire string input that must be within 30 characters... https://docs.djangoproject.com/en/dev/ref/models/fields/
models.CommaSeparatedIntegerField converts into varchar in db, so the max_length determines the length of this string.

Upvotes: 1

Related Questions