You can’t. You can change what field is the primary key, but you can’t remove the primary key. Just specify primary_key=True on the field you would like to make your primary key. >From the docs: Each model requires exactly one field to have primary_key=True<https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.Field.primary_key> (either explicitly declared or automatically added).
https://docs.djangoproject.com/en/1.11/topics/db/models/#automatic-primary-key-fields From: [email protected] [mailto:[email protected]] On Behalf Of jagadishreddy bommareddy Sent: Friday, August 4, 2017 6:53 AM To: Django users Subject: Avoid primary key in Django models.py I am using Django frame work in that models.py in any field i don't want primarykey how can i avoid primary key -- 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 [email protected]<mailto:[email protected]>. To post to this group, send email to [email protected]<mailto:[email protected]>. 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/c11a9e2d-b1e2-4e2f-9e6c-b6c74589efe0%40googlegroups.com<https://groups.google.com/d/msgid/django-users/c11a9e2d-b1e2-4e2f-9e6c-b6c74589efe0%40googlegroups.com?utm_medium=email&utm_source=footer>. For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. To post to this group, send email to [email protected]. 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/2d2e70f2060843b4b6893f4a4dc22573%40ISS1.ISS.LOCAL. For more options, visit https://groups.google.com/d/optout.

