[Vuejs]-I can't get Django to INNER JOIN properly :(

0👍

Problem solved,

I had to change the foreign key constraint Articles.ID_User which now leads to Fellows.ID.

Previously the constraint led to Fellows.User_ID.

I can finally use:

articles = Article.objects.select_related('author').order_by('-posted')[:5]

And indeed finally accessing it in the front by article.author, simple as that.

Yet I still don’t really understand why the raw sql query (using the mysql interpreter) with the INNER JOIN worked fine tho when referencing Fellows.User_ID, which was apparently not the case in the ORM.

Although it is working, my sql relational might be wrong or not ideal, therefore I am still open to suggestions!

Leave a comment