4

I have the following field in model:

short_description = models.CharField(max_length=205)

and the widget in ModelForm:

'short_description': forms.Textarea(attrs={'rows': '3', 
'minlength': 250,'maxlength': 250})

The issue:

In HTML, input, Django adds correctly minlength value, but for the maxlength value he get the value from the model field and not the one specified in the widget.

<textarea name="short_description" cols="40" rows="3"  minlength="80" maxlength="205" required="" id="id_short_description"></textarea>

How do I "force" Django to take in consideration what is specified in the widget and not in the model field.

user3541631
  • 3,686
  • 8
  • 48
  • 115

0 Answers0