Setting the initial value of the primary key in the Django model

I am preparing the model as follows:

class SomeModel(models.Model):
    id = models.BigIntegerField(primary_key=True, null=False, unique=True)

But my primary key must be a real integer of 9 + digits. If I set the starting index as 100000000. then any value expressed as idwill have a length of 9 or more.

But django does not support this. How can I implement this with minimal direct interference to django?

I use Django 1.3andPostgresql 9.1

+4
source share
1 answer

I am not a django user, but I think the postgresql command you are looking for is:

ALTER SEQUENCE big_integer_seq RESTART 100000000;

It is best to read the documentation for django / postgresql.

+8

All Articles