Need help in making a query, i am new to django and i am stuck in this.
Models.py
class Application(models.Model):
access_key_id = models.CharField(max_length=100)
access_key_secret = models.CharField(max_length=100)
class Order(models.Model):
application= models.ForeignKey(Application, on_delete=models.CASCADE)
class Payment(models.Model):
order = models.ForeignKey(Order, on_delete=models.CASCADE)
source_payment_id = models.IntegerField(blank=True,null=True)
I have Application's object as below:
app = Application.objects.get( access_key_id=123sd, access_key_secret=de454f)
how can i join the tables to make query and get the payment whose id is source_payment_id parameter and its order's application is app ?