Re: filter on multiple tables

2020-05-29 Thread Soumen Khatua
Thank You, for your guidance.I think I'm very close to this problem. Thank you once again. ‪On Fri, May 29, 2020 at 9:56 AM ‫אורי‬‎ wrote:‬ > Hi Soumen, > > You can filter on another table by using __, for > example: > > User.objects.filter(profile__profiles__institute_name="Example") > > Or:

Re: filter on multiple tables

2020-05-29 Thread Soumen Khatua
Hi, whenever I'm trying to filter as per your convention I'm getting some error like FieldError: *Eg.* *profile = Profile.objects.filter(education__profile__institute_name="IIT KGP")* of course, I'm getting this error because Profile is working here as a Foreign Key, in Education table.

Re: filter on multiple tables

2020-05-28 Thread אורי
Hi Soumen, You can filter on another table by using __, for example: User.objects.filter(profile__profiles__institute_name="Example") Or: User.objects.filter(profile__profiles__institute_name__in=["Example 1", "Example 2"]) אורי u...@speedy.net On Thu, May 28, 2020 at 11:27 PM Soumen Khatua

filter on multiple tables

2020-05-28 Thread Soumen Khatua
Actually I want to filter all users those are matched with currently logged in users based on location or education details like maybe institute_name or specialization. Is it possible to search in multiple tables?! I almost spent 2 days but still I stuck in the position. Any help would be