Monday, March 30, 2020

Django ORM query with joins

I need help with a django query...I have two models

1) POSTS
==>id
==>details
==>user(foreign key to user table)

2) USER
==>id
==>email
==>name

SQL VERSION: SELECT POSTS.ID, POSTS.DETAILS, USER.NAME FROM POSTS, USER WHERE POSTS.USER == USER.ID;

I require these details in the same queryset...is it possible ? 

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c59d7b0c-834f-47fe-8162-5e34f42c51f9%40googlegroups.com.

No comments:

Post a Comment