On Dec 8, 9:28 am, playfire <[email protected]> wrote:
> I am using django.forms for my forms and I want to style my <input>
> tags using css. I know I can customize the form template, but how do i
> customize the widget itself? Normally I would do <input id="blaaa">
> and then put the style in my css file but all I have is
> {{ form.fieldname }} to create the widget.
Well, the input automatically gets an id which is the name of the
field prefixed by 'id_', so you can use that, or you can add a class
value when you declare the field:
def MyForm(forms.Form):
myfield = forms.CharField(widget=forms.TextInput(attrs=
{'class':'myclass'}))
--
DR.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.