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))Note
Adding computed attributes to query results with the annotate() method.
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))