I want to have a model with calculated fields that I can apply sorting on. For example, let\'s say that I have the following model:
class Foo(models.Model):
If you would not mind some logic duplicaton, then the following will work:
Foo.objects.extra(select={'d_field': 'A - B'}).extra(order_by=['d_field'])