jbalogh/django-cache-machine — pull request #45 by bendemboski (2013-09-12 23:29:24+00:00)
Title: Fixes #14

This may be a bug that should be fixed in Django, but I haven't dug into as_sql() enough to understand exactly why it's raising an EmptyQuerySet exception in this case. However, the fix for this specific issue is simple enough -- catch that exception and execute the query directly.

We might be able to just return 0 and save the query in this case, but it seems safer to just execute it.