4👍
✅
Your code should remain that way:
selected_services = forms.CharField(label="Selected_services *",
widget=forms.Textarea())
Defining the TextArea widget becomes a TextField and the max_length attribute is not required
2👍
Only models.CharField
requires max_length
. You can remove it from your forms.CharField
.
Apart from that your current code looks fine. The TextArea
is the right widget to use.
- [Django]-Xapian search terms which exceed the 245 character length: InvalidArgumentError: Term too long (> 245)
- [Django]-Django & Nginx deeplinking domains (re-write rules or django urls?)
- [Django]-How to add commas / delimiters for all list items except last?
- [Django]-Django Remove all Empty Lines from Template Output
1👍
max_length
property doesn’t appear to have an upper limit.
I’ve checked the source code and this forms documentation
So you might wanna try using sys.maxint
(python 2) or sys.maxsize
(python 3) instead of arbitrary number.
- [Django]-GeoDjango serialize GeoJSON skipping 'id' field
- [Django]-How to stop Django Rest Framework from rendering html for exceptions
- [Django]-Postgres to Ubuntu Docker container linking not working
- [Django]-How to add a custom field that is not present in database in graphene django
- [Django]-Django cluster deployment
Source:stackexchange.com