Re: how to customize a form field, CSS style things.

2011-09-16 Thread Dave
On Fri, 16 Sep 2011 04:58:00 -0700 (PDT) "Kevin.X" wrote: > Dave, > Thanks for your reply. But I want a more general way to specify the > class of a widget. Is that a little boring when you want a text input > with class 'text', but you have to call forms.CharField with the > widget param every t

Re: how to customize a form field, CSS style things.

2011-09-16 Thread Jacco Flenter
Hi Kevin, For this you might want to use something like django-uni-form: http://readthedocs.org/docs/django-uni-form/en/latest/ Regards, Jacco On Fri, Sep 16, 2011 at 1:58 PM, Kevin.X wrote: > Dave, > Thanks for your reply. But I want a more general way to specify the > class of a widget. Is t

Re: how to customize a form field, CSS style things.

2011-09-16 Thread Kevin.X
Dave, Thanks for your reply. But I want a more general way to specify the class of a widget. Is that a little boring when you want a text input with class 'text', but you have to call forms.CharField with the widget param every time? On Sep 16, 7:21 pm, Dave wrote: > Does this page > :https://d

Re: how to customize a form field, CSS style things.

2011-09-16 Thread Dave
Does this page : https://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.Widget.attrs helps you ? n [1]: from django import forms In [2]: class CommentForm(forms.Form): ...: name = forms.CharField( ...: widget=forms.TextInput(attrs={'class':'special'

how to customize a form field, CSS style things.

2011-09-16 Thread Kevin.X
Hi, folks Is there any simple way to customize a form filed's style? I want to add CSS class to a filed according to it's type. Say, should have a class named 'text', tag should have a class 'select', and so on. The way I want to try is that added class attribute to widget according to widget's