vendredi 27 février 2015

Adjust CSS/html of a form element in DJango

Been trying to teach myself some CSS while working in django and have hit a wall. I'm working as part of a team. I have been using the following form to submit data (which works fine), but have been unable to change the CSS of the form element (particularly text boxes)



<div class="fieldWrapper">
{{ form.description.errors }}
<label for="{{ form.title.id_for_label }}"></label>
{{ form.description }}
</div>


Given the above code, I believe that the element I need to manipulate, and that which controls the textbox on my screen is {{ form.description }}. But I can't seem to figure out how to apply any changes to it, at least from the template page.


I've seen this done in tutorials using the input tag, and I've seen people using widgets to edit the attributes, but I don't want to change the configuration too much, and my implementation of a widget didnn't work.


Is this possible, or do I need to dig into the code and edit the forms class that controls this?


Thanks


Aucun commentaire:

Enregistrer un commentaire