added .disable_inheritance method for the simple fetch exclusives classes

This commit is contained in:
Wilson Júnior
2013-05-09 13:18:58 -03:00
parent 9dfee83e68
commit 96a964a183
2 changed files with 29 additions and 0 deletions

View File

@@ -520,6 +520,15 @@ class QuerySet(object):
queryset._none = True
return queryset
def disable_inheritance(self):
"""
Disable inheritance query, fetch only objects for the query class
"""
if self._document._meta.get('allow_inheritance') is True:
self._initial_query = {"_cls": self._document._class_name}
return self
def clone(self):
"""Creates a copy of the current
:class:`~mongoengine.queryset.QuerySet`