Hi everyone,
I have a queryset of categories and would like to exclude categories with
no items associated. I am cycling through the queryset as follows, without
the desired result:
for cat in categories:
if cat.item_set.count() == 0:
categories.exclude(pk=cat.pk)
How can I remove those categories (please note, I do not intend to delete
them)?
Thanks.
--
Regards,
Sithembewena Lloyd Dube
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.