Django doesn’t support composite primary key as the ORM heavily relies on a
single attribute of a class(e.g: pk or id) field for its inference and
usage in the django applications. Owing to this reason composite primary
keys are not permitted in Django. But you may use unique_together
constraint on the field if that fits your bill.

On Fri, 4 Oct 2019 at 5:16 PM, narendra thapa <narendrathapa...@gmail.com>
wrote:

> as i was trying to make a composite key on students model . i wanna make
> composite key of field enrolled year and roll no but django is not
> accepting a two primary key in same model
>
> --
> 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/ae2576ec-e3ae-4ec6-bbf0-e93e1965378e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ae2576ec-e3ae-4ec6-bbf0-e93e1965378e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
-- 
Warm Regards
Jagadesh
+91 88805 88859

-- 
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/CAHmRFqsU7im%2BBfRK%2BMv6gCW1-_voVDd6E86zexAq4ZXe0oB84A%40mail.gmail.com.

Reply via email to