Hi Hollandz,

You can't do that from within Django automatically. You'd need to write 
your own database migration to update the database as the assignment of the 
primary key value is part of the database and not Django. Have a look 
at 
https://docs.djangoproject.com/en/1.8/ref/migration-operations/#django.db.migrations.operations.RunSQL

/Markus

On Saturday, August 8, 2015 at 8:10:35 PM UTC+10, Holland_zwz wrote:
>
> Hi all,
>  I want to add one auto-increase PK which start from one given value(such 
> as start from 1000).
>
> I try to write the model as following:
>
> class MyModel(models.Model):
>     mid = models.AutoField(verbose_name='My 
> ID',primary_key=True,default='1000')
>
>
> But only one record can be add when i add records in admin web site.
>
> Any ways to support this? thanks
>
> Regards,
> Hollandz
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7e6ef24b-cff7-47a6-b6ac-a0d2c54be354%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to