#17654: auto_now_add=True column creates IntegrityError if model is saved by
specifying an id
-------------------------------------+-------------------------------------
     Reporter:  gtorok@…             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  1.3
  (models, ORM)                      |               Resolution:  invalid
     Severity:  Normal               |             Triage Stage:
     Keywords:  auto_now_add,        |  Unreviewed
  IntegrityError                     |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by akaariai):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 There isn't any bug if this happens only when there is already an object
 with the same PK in the database. Because now you are not doing an add,
 you are doing an update. I think it works as specified, although I can see
 that this might be a bit confusing. The key here is that the id field's
 value identifies the object, so from Django's point of view you are really
 saving the same object to the DB, not adding a new one.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17654#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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-updates?hl=en.

Reply via email to