Thursday, November 1, 2012

Re: unable to save ModelForm with primary key change

On Thu, Nov 1, 2012 at 3:33 PM, msoulier <msoulier@digitaltorque.ca> wrote:
> Hi,
>
> I'm trying to modify a model instance, specifically the field which is
> the model's primary key. When I save, nothing seems to happen.
> Everything in cleaned_data is good, but the model is not updated. No
> exception is thrown, the field isn't updated, nothing.
>
> All I'm doing is
>
> form = MyForm(request.POST, instance=model_instance)
> if form.is_valid():
> form.save()
>
> I'm thinking that this might be an issue with respect to how sqlite
> handles changes to primary key fields. Perhaps I'm handling the change
> incorrectly. Help appreciated.
>
> Using Django 1.4.1 with python-sqlite2 2.6.3 and 3.6.20.
>
> Thanks,
> Mike
>

Please show the definition of MyForm. I assume you are certain that
the form is valid, ie you have put breakpoints there (or print
statements) and form.is_valid() is definitely returning true.

Cheers

Tom

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment