On Mon, 2008-09-29 at 16:07 -0700, globophobe wrote: [...] > However, if I want to change an existing object it seems I must use > request.POST, i.e. > > f = ArticleForm(request.POST, instance=a) > > Because, > > f = ArticleForm({'title':'Old news'}, instance=a) > > In [64]: f.is_valid() > Out[64]: False > > How can I pass a dictionary rather than request.POST to change an > existing object?
I strongly suspect you're debugging the wrong problem here. ModelForms accept dictionaries quite happily. The fact that your form doesn't pass validation doesn't mean it's because you passed in a dictionary. It's because you didn't pass in all the required data or because some of the data is invalid. Have a look at the errors associate with the form and that should give you some more information (for example, you aren't passing the 'id' field for the form). Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---