I have a queryset in my Django views.py
. I'm using annotate
to add a promo
property to each object based on each object's id
. However this is not working:
bytes = Byte.objects.filter(
published=True
).annotate(
# add path to promo image based on byte's id property
promo=Value('../static/images/promo-'+id+'.png', output_field=CharField())
).order_by(
'-publish_date'
)
I get the error: name 'id' is not defined