Hello Friends,

i have in models.py following:

class Money(Standard_Model_Mixin):
    title = models.CharField(default="", max_length=120, blank=True, 
null=True)
    amount = models.DecimalField(max_digits=6, decimal_places=2, 
blank=False, null=False) 

class Moneyreport(Standard_Model_Mixin,Mayan_DMS_Mixin):
    date = models.DateField (default=now, blank=False, null=False)


class Moneyreport_Line(Standard_Model_Mixin):
    moneyreport_link = models.ForeignKey(Moneyreport,default='', 
blank=False, null=False, on_delete=models.CASCADE, 
related_name="moneyreport_link")
    money_link = models.ForeignKey(Money, 
on_delete=models.CASCADE,default='', blank=False, null=False, 
related_name="money_link")
    quantity = models.PositiveIntegerField(default=0, blank=False, 
null=False)

Now i have in Money a entry like:

(id,title,amount) Values ((1,"50 $","50"),(2,"100 $","100"))

in Moneyreport:

(id,date) VALUES (1,'25.04.2023')

and Moneyreport_Line:

('moneyreport_link','money_link','quantity') VALUES ((1,1,3))

Now i want i left outer join so i get a table like:

|money_link.title|quantity|
|50 $                    |               |
|100 $                  |3            |

In SQL i would make a left join like:

SELECT Money.title,ml.quantity FROM Moneyreport_Line as ml LEFT OUTER JOIN 
Money ON Money.id = ml.money_link    

How i make this in django without raw query?

Regards                       


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/78dc9c7a-5acc-413b-8e12-3965ce9659ban%40googlegroups.com.

Reply via email to