For those of us not using django 1.0 (yet)
Newforms are great, and ModelForms will be a welcome release. However, I find I can’t utilize the over simplified workflow:
myform = MyForm(request.Post) myform.save()
because I have to process one or more fields before saving. But there aren’t a lot of explicit examples – for some strange reason, you are required to call .is_valid() on the form before trying to access the clean_data, like this:
myform = MyForm(request.POST) myform.is_valid() # this creates the clean_data dictionary attribute = myform.clean_data['attributename']
Seems like the sort of thing I would code an exception into the clean_data accessor – ‘you must first call is_valid() before using’. Maybe that’s just me.