Django: Ticket #6444: Filter for adding css classes to an widgethttps://code.djangoproject.com/ticket/6444
<p>
As a widget class is something related to the T in the MTV django design, it should be possible to change a widget's class through
a template. So, who's the fellow that deals with the T? The designer! Not necessarily the programmer. And that someone should not need to know
python programming. The designer should be capable of adding a class to a widget in a straight forward way. A filter seems like the reasenable
solution.
</p>
<p>
Something like this should work:
</p>
<pre class="wiki">&lt;div&gt;
form.field|filter:"class1 class2 class3"
&lt;/div&gt;
</pre><p>
and give the proper output. I suggest a simple name for the filter, something like mclass ou css.
</p>
en-usDjangohttps://www.djangoproject.com/s/img/site/hdr_logo.gifhttps://code.djangoproject.com/ticket/6444
Trac 1.2Chris BeavenThu, 31 Jan 2008 03:32:55 GMTstage changedhttps://code.djangoproject.com/ticket/6444#comment:1
https://code.djangoproject.com/ticket/6444#comment:1
<ul>
<li><strong>stage</strong>
changed from <em>Unreviewed</em> to <em>Design decision needed</em>
</li>
</ul>
<p>
Hrm... I get the argument but I'm not sure I quite see the necessity.
</p>
<p>
Pushing to design decision, perhaps you can bring this up on django-dev?
</p>
TicketJames BennettThu, 31 Jan 2008 09:32:12 GMTstatus changed; resolution sethttps://code.djangoproject.com/ticket/6444#comment:2
https://code.djangoproject.com/ticket/6444#comment:2
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>duplicate</em>
</li>
</ul>
<p>
Aren't there already multiple tickets open with variations on easy ways to add CSS classes to parts of a form?
</p>
Ticket