﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13564	Provide class attributes for form fields	h3		"I work a lot with Django forms and I'm also working on grappelli and I've come to find that there's one thing that is cruelly missing from django's forms..

Meaningful class names on form inputs.

As now if I want to change the class name of an input I either have to write the forms explicitly or do something like this for *every* forms:

{{{

from django import forms
from django.forms import widgets

class MyForm(forms.Form):
    title = forms.CharField(required=True, widget=widgets.TextInput(attrs={
        'class': 'charfield required'
    }))

}}}

Whereas it would be easy to simply use the field type's name to generate a meaningful class;

{{{

<input type=""text"" value="""" class=""django-charfield django-required"" />

}}}

The ""required"" is not crucial, but would be really useful for JavaScript enhanced validation.
That said, just a class hinting the field type would be a 100% improvement.


Finally, it's not just for JavaScript. It would also be useful for CSS styling. For example when 
I use a PositiveInteger field I never need it to be the same width as a Char field. It would
be nice to be able to style them without having to write many lines of Python or HTML codes."	New feature	new	Forms	1.2-beta	Normal			Gabriel Grant trebor74hr@…	Accepted	1	0	0	1	0	0
