Django + Postgres: How to specify sequence for a field
- by Giovanni Di Milia
I have this model in django:
class JournalsGeneral(models.Model):
jid = models.AutoField(primary_key=True)
code = models.CharField("Code", max_length=50)
name = models.CharField("Name", max_length=2000)
url = models.URLField("Journal Web Site", max_length=2000, blank=True)
online = models.BooleanField("Online?")
active = models.BooleanField("Active?")
class Meta:
db_table = u'journals_general'
verbose_name = "Journal General"
ordering = ['code']
def __unicode__(self):
return self.name
My problem is that in the DB (Postgres) the name of the sequence connected to jid is not journals_general_jid_seq as expected by Django but it has a different name.
Is there a way to specify which sequence Django has to use for an AutoField? In the documentation I read I was not able to find an answer.