On Jun 15, 3:20 pm, Genis Pujol Hamelink <[email protected]>
wrote:
> Hi list,
>
> I am trying to create a view to update objects in the db:
>
> http://dpaste.com/55546/
>
> but when posting the data, form.is_valid() fails because the object already
> exists in the db. Is there a way to validate a form using an existing object
> and then save it?
>
> regards,
>
> --
> Genís

Yes, pass the instance as a parameter to the form instantiation.
form = MyForm(instance=instance)
--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to