newforms

Define css class in django Forms

Assume I have a form class SampleClass(forms.Form): name = forms.CharField(max_length=30) age = forms.IntegerField() django_hacker = forms.BooleanField(required=False) Is there a way for me to define css classes on each field such that I can then use jQuery based on class in my rendered page? I was hoping not to have to m...

Add class to Django label_tag() output

I need some way to add a class attribute to the output of the label_tag() method for a forms field. I see that there is the ability to pass in an attrs dictionary and I have tested it in the shell and I can do something like: for field in form: print field.label_tag(attrs{'class':'Foo'}) I will see the class='Foo' in my output, ...

Anyone know an up-to-date (September 2009) example of file-uploading in Django?

UPDATE : thanks to posters below, it's clear that the official documentation is up-to-date. Best to read that carefully rather than skim a bunch of other pages that turn up in Google. I keep finding examples and snippets for uploading files in Django, but then reading people saying that they're out of date. Here are my basic confusio...