#22968: can not get primary key after insert
-------------------------------+--------------------
Reporter: khaihkd | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Example, in database mysql, I have a table
User(id: integer primary key AUTO INCREMENT, name: string)
When I create new record
{{{
user = User()
user.name = "This is name"
user.save()
}}}
=> success
I can not get user id
{{{
print(user.id) => none
print(user.pk) => none
}}}
=> How to get it? Please help me. Thank you very much
--
Ticket URL: <https://code.djangoproject.com/ticket/22968>
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/050.26e01a1ab85e3dae730c464038d76aba%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.