Changes between Initial Version and Version 2 of Ticket #20742


Ignore:
Timestamp:
Jul 18, 2013, 3:49:53 PM (11 years ago)
Author:
Karen Tracey
Comment:

A concrete suggestion for what's wanted here would help, as it is I'm not sure what's being asked for.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20742

    • Property Summary ModelForm primary_key update with instance set is executed as INSERT caused by is_valid() chaning the instanceModelForm primary_key update with instance set is executed as INSERT caused by is_valid() changing the instance
    • Property Resolutionneedsinfo
    • Property Status newclosed
  • Ticket #20742 – Description

    initial v2  
    11I do agree this is a bad database design but it's executed without any warning or anything in the docs so i want to open this ticket to allow the discussion of raising an Error or anything (e.g. an info in the docs @primary_key or modelform) not let anyone run into this mistake.
    22
    3 
     3{{{
     4#!python
    45class Test(models.Model):
    56  email = models.CharField(max_length=100, primary_key=True)
     
    1516
    1617# here instance is updated with new@example.com as pkey and django thinks it has to create a new model instance not updating the old instance
     18
    1719if form.is_valid():
    1820   new_x = form.save()
    1921   new_x.save()
     22}}}
Back to Top