Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django CharField with no max length

I have a frontend that will be sending bas64 images, I will put those very large strings on a variable and send it to a form. What kind of FormField can I use?

The regular CharFields need a max_length. Since it is a very large string, I don't know the length it could have.

like image 964
Alejandro Veintimilla Avatar asked Nov 29 '16 15:11

Alejandro Veintimilla


People also ask

What is the max length of CharField django?

CharField since CharField has a max length of 255 characters while TextField can hold more than 255 characters.

What is the difference between CharField and TextField in django?

TextField can contain more than 255 characters, but CharField is used to store shorter length of strings. When you want to store long text, use TextField, or when you want shorter strings then CharField is useful.

What is CharField in django?

CharField is a string field, for small- to large-sized strings. It is like a string field in C/C+++. CharField is generally used for storing small strings like first name, last name, etc. To store larger text TextField is used. The default form widget for this field is TextInput.

What is CharField model?

CharField is a commonly-defined field used as an attribute to reference a text-based database column when defining Model classes with the Django ORM. The Django project has wonderful documentation for CharField and all of the other column fields.


1 Answers

Maybe TextField could be the right choice.

like image 56
Massimo Variolo Avatar answered Sep 18 '22 08:09

Massimo Variolo