[Fixed]-M2m for existing table (through/unique_together)

1👍

Django requires each model to have exactly one primary key field. It doesn’t support multiple-column primary keys yet.

Since you haven’t explicitly defined a primary key on the SupervisorProject model, Django assumes that there is an automatic primary key field id. When it includes the id field in a query, you get the error because it doesn’t exist.

If possible, I would add an auto-incrementing id column to each intermediate table. There isn’t a way to get Django to add the column to the tables automatically. You have set managed=False, so Django expects you to manage the database table.

Leave a comment