4👍
✅
Actually, I have found an easy way to do this without touching the css files (which I shouldn’t do in this particular project). Just add a 100% width attribute to the text field and it will fill up whatever
/ or whatever it is part of which will automatically place the text on top of the text field.
introduction_text = forms.CharField(widget=forms.Textarea(attrs={'style': "width:100%;"}))
0👍
By adding help
in .py field you can make label/description above the text box.
Like this -> introduction_text = forms.CharField(widget=forms.Textarea,help='You can add description here')
- [Django]-How to differentiate the first time registered and regular logged in user in django
- [Django]-Django query using IN()
- [Django]-How to prefill the image field on form validation error Django?
-1👍
Wrapping the text with a div
will let textarea to come on a new line. Since div
is a block element.
<div>
<form method="post">
<div>
{% csrf_token %}
</div>
<div>
{{ form.as_p }}
</div>
<input type="submit" value="Submit">
</form>
</div>
- [Django]-"bar" in a Django template expression is a literal?
- [Django]-Django error report emails – customize settings parameters
- [Django]-How pass two parameters to url (without GET)?
- [Django]-Django with IronPython and VS2010?
Source:stackexchange.com