Tuesday, October 30, 2018

how do we create a custom primary key in django




                         id = models.CharField(primary_key=True,default='first')
.how can i insert a  custom auto generated primary with the organization name for example 'cha' and  a number starting from 1000 so the final id would be cha1000 and next id would be cha1001



Thanks & Regars
chaitak

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b4c99c49-9f91-4ed2-aee2-b5d6af1685a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment