Hey, you have to write custom raw query for join tables which are not connected with foreign key relationship in django.
On Sun, Jul 24, 2022, 11:17 Lalit Suthar <[email protected]> wrote: > this can be helpful > > https://betterprogramming.pub/django-select-related-and-prefetch-related-f23043fd635d > > On Sun, 24 Jul 2022 at 00:30, Ryan Nowakowski <[email protected]> wrote: > >> On Fri, Jul 22, 2022 at 12:16:14PM +0530, Avi shah wrote: >> > I have two tables >> > Tbl 1 >> > & >> > Tbl 2 >> > >> > I need to connect the two tables using a join >> >> If these tables were created outside of Django, in other words, not >> using manage.py migrate, you can use Django's legacy database support to >> auto generate the models[1]. After that, each table will have a model >> associated with it. You can then use Django's ForeignKey support to query >> the tables. >> >> >> [1] https://docs.djangoproject.com/en/4.0/howto/legacy-databases/ >> >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/20220723185935.GB15838%40fattuba.com >> . >> > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAGp2JVHauj%2BS47HfmcYOrNQHJk3bTQbtdBm%3DdLRNx_8woM6XwQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAGp2JVHauj%2BS47HfmcYOrNQHJk3bTQbtdBm%3DdLRNx_8woM6XwQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABwiCvrSuY6AmBkARJFt%2BaCeR_wFVGf%3DKWdLP227GApDW4AcWQ%40mail.gmail.com.

