Is there any way to reduce the size of the description box used below? I used it on a HTML template under a django project when I rendered the page the description box was huge.
<div >
<div >
<form action="{% url 'create_post' pk=classroom.id %}" method="POST" enctype="multipart/form-data">
{% csrf_token %}
<div >
{{ post_form.title|attr:"class:form-control"|attr:"placeholder:Title"}}
</div>
<div >
{{ post_form.description|attr:"class:form-control"|attr:"placeholder:Description" }}
</div>
<button type = "submit" >
Post
</button>
<button id = "cancel-post" >
Cancel
</button>
</form>
</div>
</div>
CodePudding user response:
try this
{{ post_form.description|attr:"class:form-control"|attr:"placeholder:Description"|attr:"rows:4"}}
https://pypi.org/project/django-widget-tweaks/
https://github.com/jazzband/django-widget-tweaks#attr
{% load widget_tweaks %}
<!-- add/change several attributes -->
{{ form.text|attr:"rows:20"|attr:"cols:20"|attr:"title:Hello, world!" }}