Why this code allways create new objects and never update them!? How
to update objetcs, not create them using form.save()
Model PK is AutoField. When it not autoincrement field everything
works fine!
class ModelFormClass(ModelForm):
class Meta:
model = MyModel
if request.method == 'POST':
new_data = request.POST.copy()
form = ModelFormClass(new_data)
if form.is_valid():
new_object = form.save()
response = model_post_save(new_object)
return response
else:
form = ModelFormClass(instance=edited_object)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---