I am looking for some way to define some wrapper that is called before i call to Model.objects.all()
.
I want whenever i call, Model.objects
it call my method (wrapper) and then return the objects back to the query.
Lets take an example:
MyModel.objcts.filter(name="Jack")
Wrapper:
def mymodelWrapper(self):
return self.objects.annotate(size=Sum('id', field='order_size_weight*requested_selling_price'))
I want to run annotate in the background and also want to apply the filter. I Know what i want to achieve, its the code i am looking for how to do that.