[Django]-Django – How does a query query itself?

4👍

You need to use F expressions for this query.
Your query would look the following way:

products = Product.objects.filter(
    Q(delivery_date__lte=(datetime.datetime.now() + timedelta(days=F('contract__safety_days'))))
)

Leave a comment