How to make auto increment field in django which starts from 10000
<p>I want to make an auto increment field in Django which starts from bigger value , I found use <strong>Autofield</strong> in models but It starts from 1 .</p>

<pre><code>class University(models.Model):
    id = models.AutoField(primary_key=True)
    university_name = models.CharField(max_length=250, unique=True)
    university_slug = models.SlugField(max_length=250, unique=True)

    def __unicode__(self):
        return self.university_name
</code></pre>

<p>How can do this ? Any helpful suggestion will be appreciated ?</p>

<p>The simplest is to catch the <a href="https://docs.djangoproject.com/en/1.10/ref/signals/#post-migrate" rel="nofollow">post migrate signal</a></p>

<pre><code>from django.apps import AppConfig
from django.db.models.signals import post_migrate

def my_callback(sender, **kwargs):
     if sender.name = 'myapp'
     try:
         University.objects.create(pk=999, ...)
         University.objects.delete()
     except IntegrityError:
         pass

class MyAppConfig(AppConfig):
    ...

    def ready(self):
        post_migrate.connect(my_callback, sender=self)
</code></pre>

<p>What we are doing here is creating a record and deleting it immediately. On mysql that changes the next value in the auto increment. It doesn't matter that the record has been deleted. The next asigned number will be 1000. </p>

python mysql django django-models