I want to add a static value to the results of a database query using django (so not using \'raw\' SQL)
For example, if I have an object Car with fields make, model, and
As of Django 1.8, annotate features Value expression:
annotate
from django.db.models import Value, IntegerField cars= Car.objects.all().annotate(sales=Value(0, IntegerField()))
Instead of IntegerField you can use all available db fields classes.
IntegerField