Skip to content
thesarfo

Note

Annotating Objects

Adding computed attributes to query results with the annotate() method.

views 0

Sometimes we wanna add additional attributes to our objects while querying them, this is where we use the annotate method. see below

def say_hello(request):
queryset = Customer.objects.annotate(is_new=Value(True))