1👍
After reading your answer I finally get the question, you are looking for composite keys in Django. Unfortunately this is not supported by Django yet. If you need it there are a few options:
-
Try the Django Composite Key project: https://github.com/simone/django-compositekey
-
Use the patches and explanation given on this page to add the support to Django: https://code.djangoproject.com/wiki/MultipleColumnPrimaryKeys
-
Use SQLAlchemy (http://www.sqlalchemy.org/) for querying as it does support this properly.
-
Use a single primary key column in Django and read/write from/to a writable view which communicates with the actual table in the background.
Source:stackexchange.com