SmileyChris

Change the look of fields in Django admin

Rambling on about Django 78 months ago.

I've answered the question about changing the visual width of fields several times in #django IRC. I may as well write it down somewhere so I don't have to repeat myself. :)

Step 1: Create a template file (replacing the [blocks] with appropriate info) named admin/[appname]/[objectname]/change_form.html. Fill it with something like:

{% extends "admin/change_form.html" %}

{% block extrastyle %}
<style type="text/css">
#id_[fieldname] { width: 20em; }
</style>
{% endblock %}

Step 2: Dance with joy

Leave a comment or see my other ramblings.

Leave a comment