#24539: Attempt to create object with repeated value on a custom PK raises
IntegrityError on wrong field
-------------------------------+------------------------------------
Reporter: emyller | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Comment (by bmispelon):
I'm not sure this is actually a bug.
When you save a mode that has its primary key set, Django will look in the
database to see if that key exists.
If it's found, then the corresponding record is updated (hence why you see
an `UPDATE` query) with the values set on the instance.
What's happening here is that the `UPDATE` query tries to set `created` to
`NULL` because the object you're saving has `created = None`.
--
Ticket URL: <https://code.djangoproject.com/ticket/24539#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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.19829fe44f96a82c477aa3bc607df984%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.