Answer the question
In order to leave comments, you need to log in
How to edit css styles in forms in Django?
Guys, hello everyone.
Now I am connecting forms on Djange to my site (generating them based on the model). The question is, how to set css for the form? Something I somehow did not quite understand.
Answer the question
In order to leave comments, you need to log in
<div class="input-field col-md-12">
<div class="row">
{{ form.username }}
<label for="nick_name">Нікнейм</label>
</div>
</div>
<div class="input-field col-md-6">
{{ form.first_name }}
<label for="first_name">Ім’я</label>
</div>
<div class="input-field col-md-6">
{{ form.last_name }}
<label for="last_name">Прізвище</label>
</div>
https://github.com/kmike/django-widget-tweaks
or as an option in the form:
self.fields['field_name'].widget.attrs['class'] = 'your_class'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question