Hi,
I have a strange behaviour on my Django/PostgreSQL system.
After saving a model object the primary key is none although it's an AutoField and the id is correctly saved in the database.
The following script passage returns None for the id:
a = SomModelClass()
a.someattribute = 'xyz'
a.save()
a.someattribute
>>> 'xyz'
a.id
>>> None
The model class looks somehow like this:
class SomeModelClass(models.Model):
id = models.AutoField(db_column = 'id', primary_key = True)
someattribute = models.CharField(db_column = 'someattribute', max_length = 200)
This behaviour occurs only on this model; all other models work fine.
The problem appeared one day without changing the model structure.
Perhaps there is some problem with the data integrity of the database? Using another database server it works fine.
Best regards!