id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 8799,.save() and .objects.create() does not set the primary key when the model has an explicit primary key field,vmihaylov@…,nobody,"Here is what I observed on django1.0-beta2 and 0.96 releases with MySQL or Sqlite3.[[BR]] I have the following table:[[BR]] Sqlite: {{{ CREATE TABLE ""Person"" ( ""id"" integer NOT NULL PRIMARY KEY, ""name"" text NOT NULL ) MySQL: CREATE TABLE `Person` ( `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` longtext NOT NULL ) }}} In the models.py I have {{{ class Person(models.Model): id = models.IntegerField(primary_key=True) name = models.TextField() class Meta: db_table = u'Person' }}} When I issue: {{{ p = Person.objects.create(name='Bob') p.id }}} I get nothing. The record however is persisted. Same happens with {{{ p = Person('name'=Bob) p.save() p.id }}} If however the model is missing the id field and django auto generates it: {{{ class Person(models.Model): name = models.TextField() class Meta: db_table = u'Person' }}} Than everything is OK. The id is set correctly.",,closed,"Database layer (models, ORM)",,,invalid,,,Unreviewed,0,0,0,0,0,0