# Ultimate Django Series - Annotating objects

**URL:** https://forum.codewithmosh.com/t/ultimate-django-series-annotating-objects/22270
**Category:** Django
**Created:** [August 29, 2023, 6:52pm UTC](https://forum.codewithmosh.com/t/ultimate-django-series-annotating-objects/22270 "2023-08-29T18:52:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Pisicuta](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@Pisicuta](https://forum.codewithmosh.com/u/Pisicuta)
#### Post date: [August 29, 2023, 6:52pm UTC](https://forum.codewithmosh.com/t/ultimate-django-series-annotating-objects/22270/1 "2023-08-29T18:52:05Z")

</div>

Three day old installation of  
Python 3.11  
Django version 4.2.4, using settings ‘storefront.settings’

I’m following along with Mosh coding as he is coding.

queryset = Customer.objects.annotate(is\_new = True) - fails as advertised.

Add this:  
from django.db.models import Value  
change the queryset to this  
queryset = Customer.objects.annotate(is\_new=Value(True)) - gives a blank screen and NO SQL

Selecting SQL in the Django debug toolbar shows

SQL queries from 0 connections

No SQL queries were recorded during this request.

I’ve looked at this for so long I am going word blind.

Can anyone see what I have done wrong or mis-typed? Or is there a reason for this

---

<div class="post-metadata">

### Author: ![Pisicuta](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@Pisicuta](https://forum.codewithmosh.com/u/Pisicuta)
#### Post date: [August 29, 2023, 7:24pm UTC](https://forum.codewithmosh.com/t/ultimate-django-series-annotating-objects/22270/2 "2023-08-29T19:24:37Z")

</div>

It’s always good to find your own mistakes.

It’s not so good when you’ve been a total clutz and not put the query result into the render!

---

<div class="post-metadata">

### Author: ![nowakds](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/nowakds/32/6819_2.png) [@nowakds](https://forum.codewithmosh.com/u/nowakds)
#### Post date: [August 31, 2023, 3:07am UTC](https://forum.codewithmosh.com/t/ultimate-django-series-annotating-objects/22270/3 "2023-08-31T03:07:20Z")

</div>

Ask yourself what you’re returning with Customer.objects.annotate(is\_new = True)

Annotate creates a field. How do you return all records in a queryset?

.all() returns all querysets so Customer.objects.annotate(is\_new = True).all() returns all querysets of Customer model with the new field added.

Yours returns nothing because it only creates the fields.
