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'])
More Related Contents:
- Django: Populate user ID when saving a model
- How to revert the last migration?
- Get model’s fields in Django
- Can django’s auth_user.username be varchar(75)? How could that be done?
- Manager isn’t available; User has been swapped for ‘pet.Person’
- How do you serialize a model instance in Django?
- How to get the list of the authenticated users?
- Django: How do I add arbitrary html attributes to input fields on a form?
- creating my own context processor in django
- Get list item dynamically in django templates
- Select DISTINCT individual columns in django?
- What is the right way to use angular2 http requests with Django CSRF protection?
- Getting ‘DatabaseOperations’ object has no attribute ‘geo_db_type’ error when doing a syncdb
- Django: ordering numerical value with order_by
- Access kwargs from a URL in a Django template
- How to register users in Django REST framework?
- Example of Django Class-Based DeleteView
- Accelerate bulk insert using Django’s ORM?
- Django admin DoesNotExist at /admin/
- Pass request context to serializer from Viewset in Django Rest Framework
- Django: permission denied when trying to access database after restore (migration)
- UnicodeEncodeError: ‘ascii’ codec can’t encode character
- How can I upload and download files with graphene-django?
- Django give Error 500 for all static files like CSS and Images, when DEBUG is False
- Django’s forms.Form vs forms.ModelForm
- How do I set up Jupyter/IPython Notebook for Django?
- Having trouble with user.is_authenticated in django template
- How to render form field with information that it is required
- Forbidden (403) CSRF verification failed. Request aborted
- Django – [Errno 111] Connection refused