i have a Order and OrderProductDetail model
class Order(models.Model):
owner = models.ForeignKey(User, on_delete=models.CASCADE)
is_paid = models.BooleanField(verbose_name='?????? ??? / ????')
payment_date = models.DateTimeField(blank=True, null=True, verbose_name='????? ??????')
class OrderProductDetail(models.Model):
order = models.ForeignKey(Order, on_delete=models.CASCADE, verbose_name='??? ????')
product = models.ForeignKey(Mahsoolat, on_delete=models.CASCADE, verbose_name='?????')
price = models.IntegerField(verbose_name='???? ?????')
created_at = models.DateTimeField(verbose_name="????? ???", default=datetime.datetime.now())
in views.py (orders have two items)
orders = Order.objects.filter(owner_id=request.user.id, is_paid=True)
at each item of orders contain several items now how can i retrieve all items of orders that exist in OrderProductDetail model
question from:https://stackoverflow.com/questions/65600803/how-to-use-relationship-in-django