#5139: Custom primary_key broken when saving
--------------------------------------+-------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: nobody
Status: new | Component: Database wrapper
Version: SVN | Resolution:
Keywords: primary_key save | Stage: Unreviewed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
--------------------------------------+-------------------------------------
Changes (by Fredrik Lundh <[EMAIL PROTECTED]>):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Removing the has_auto_field check seems to fix this, but it's probably
there for a reason:
{{{
Index: ../django/db/models/base.py
==================================================================
-- ../django/db/models/base.py (revision 6184)
++ ../django/db/models/base.py (working copy)
@ -254,7 +254,7 @@
cursor.execute("INSERT INTO %s (%s) VALUES (%s)" %
(qn(self._meta.db_table), qn(self._meta.pk.column),
connection.ops.pk_default_value()))
if self._meta.has_auto_field and not pk_set:
if not pk_set:
setattr(self, self._meta.pk.attname,
connection.ops.last_insert
id(cursor, self._meta.db_table, self._meta.pk.column))
transaction.commit_unless_managed()
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/5139#comment:1>
Django Code <http://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
-~----------~----~----~----~------~----~------~--~---