Commit a49b4d58 by Bridger Maxwell

Patch for django bug where EmptyQuerySet actually needs the model to be set (or…

Patch for django bug where EmptyQuerySet actually needs the model to be set (or it can't raise a DoesNotExist exception).
parent 72165849
...@@ -91,7 +91,7 @@ class ArticleFkEmptyQuerySet(ArticleFkEmptyQuerySetMixin, EmptyQuerySet): ...@@ -91,7 +91,7 @@ class ArticleFkEmptyQuerySet(ArticleFkEmptyQuerySetMixin, EmptyQuerySet):
class ArticleManager(models.Manager): class ArticleManager(models.Manager):
def get_empty_query_set(self): def get_empty_query_set(self):
return ArticleEmptyQuerySet() return ArticleEmptyQuerySet(model=self.model)
def get_query_set(self): def get_query_set(self):
return ArticleQuerySet(self.model, using=self._db) return ArticleQuerySet(self.model, using=self._db)
def active(self): def active(self):
...@@ -127,7 +127,7 @@ class URLPathQuerySet(QuerySet, ArticleFkQuerySetMixin): ...@@ -127,7 +127,7 @@ class URLPathQuerySet(QuerySet, ArticleFkQuerySetMixin):
class URLPathManager(TreeManager): class URLPathManager(TreeManager):
def get_empty_query_set(self): def get_empty_query_set(self):
return URLPathEmptyQuerySet() return URLPathEmptyQuerySet(model=self.model)
def get_query_set(self): def get_query_set(self):
"""Return a QuerySet with the same ordering as the TreeManager.""" """Return a QuerySet with the same ordering as the TreeManager."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment