解决方法
我喜欢这样做:
def login(request): form = AuthenticationForm(request) form.fields['username'].widget.attrs['class'] = "custom_css" form.fields['password'].widget.attrs['style'] = "background:red" return render_to_response("login.html",{'form':form},context_instance=RequestContext(request))