On 12/27/06, medhat <[EMAIL PROTECTED]> wrote:
Is there a way to create an empty queryset?! Let's say I have a manager
to return all the items with the given tags, and I want to return "no
items" if one of the given tags does not exist. Right now I return an
empty list, but this causes an error in generic views. Is there a way
to create an empty QuerySet object without hitting the database?

I just had to do this the other day, and I ended up doing a hack like this:

   MyModel.objects.extra(where=['1=0'])

That still hits the database, though. I'm not aware of a way to get an
empty QuerySet without hitting the database. Maybe we should add one?

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to