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+unsubscribe@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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment