Yes, at the time of add a new record in model, automatically I want to create a custom ID and insert it into model
On Wed 24 Jun, 2020, 7:18 AM Clive Bruton, <cl...@indx.co.uk> wrote: > > On 23 Jun 2020, at 23:32, Oleg Kishenkov wrote: > > > Hello Soumen, you should use a CharField with the primary_key=True > > attribute for your model. This way no no automatic primary key > > field is generated, your field will be implicitly unique and non- > > null though. Only one primary key is allowed in a model. > > > > class Foo(models.Model) > > id = models.CharField(max_length=15, primary_key=True) > > Just to clarify this, are you indicating that when you create the > record you generate a unique custom key yourself and insert this? > > > -- Clive > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/E9317D0D-0A25-48CE-9396-5FB181075045%40indx.co.uk > . > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6Wb2dEug6QeRrO5hdxTJV-4v4OzkrDajqTV7UNm8q9vGFg%40mail.gmail.com.