How can I prevent this from happening
Asked
Active
Viewed 91 times
1 Answers
0
A Django TextField
is rendered as a HTML textarea
.
Looking at this question, you could use style="resize: none;"
.
If you would like to add that in your views/form (and not in the templates), you could try something like:
class MyModelForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['my_field_name'].widget.attrs['style'] = 'resize: none;'
or if you have a form instance
form.fields['my_field_name'].widget.attrs['style'] = 'resize: none;'

Ralf
- 16,086
- 4
- 44
- 68