Django textbox approach in model

I have a field in the model that I want users to feel that they can write arbitrary amounts of text. Django provides CharField and TextField in models. I assume the difference is that one of them is char (max_length) and the other is varchar inside.

I am tempted to use TextField, but since it does not match max_length, I am somewhat afraid that someone will dump a lot of data into it and DOSing my server. How can I handle this?

Thanks!

+5
source share
1 answer

The fields in the model only show how data is stored in the database.

, . .

class InputForm(forms.Form):
    text = forms.CharField(max_length=16384, widget=forms.TextArea)
    ...

, 16k.

+7

All Articles