-
-
Save funvit/6379416 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db.models.query import EmptyQuerySet | |
| class FakeQuerySet(EmptyQuerySet): | |
| """Turn a list into a Django QuerySet... kind of.""" | |
| def __init__(self, model=None, query=None, using=None, items=[]): | |
| super(FakeQuerySet, self).__init__(model, query, using) | |
| self._result_cache = items | |
| def count(self): | |
| return len(self) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment