Code

Changes between Initial Version and Version 2 of Ticket #20742


Ignore:
Timestamp:
07/18/13 13:49:53 (9 months ago)
Author:
kmtracey
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 Status changed from new to closed
    • Property Patch needs improvement unset
    • Property Needs tests unset
    • Property Summary changed from ModelForm primary_key update with instance set is executed as INSERT caused by is_valid() chaning the instance to ModelForm primary_key update with instance set is executed as INSERT caused by is_valid() changing the instance
    • Property Needs documentation unset
    • Property Resolution changed from to needsinfo
  • 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}}}