Add on missing values and values_list methods while we're at it, for the same reasons.
This commit is contained in:
parent
24bdf124f5
commit
c729b6b916
1 changed files with 25 additions and 1 deletions
|
|
@ -621,7 +621,7 @@ class TypeclassManager(TypedObjectManager):
|
||||||
|
|
||||||
def annotate(self, *args, **kwargs):
|
def annotate(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Overload annotate method to first call .all() to filter on typeclass before annotating.
|
Overload annotate method to filter on typeclass before annotating.
|
||||||
Args:
|
Args:
|
||||||
*args (any): Positional arguments passed along to queryset annotate method.
|
*args (any): Positional arguments passed along to queryset annotate method.
|
||||||
**kwargs (any): Keyword arguments passed along to queryset annotate method.
|
**kwargs (any): Keyword arguments passed along to queryset annotate method.
|
||||||
|
|
@ -631,6 +631,30 @@ class TypeclassManager(TypedObjectManager):
|
||||||
"""
|
"""
|
||||||
return super(TypeclassManager, self).filter(db_typeclass_path=self.model.path).annotate(*args, **kwargs)
|
return super(TypeclassManager, self).filter(db_typeclass_path=self.model.path).annotate(*args, **kwargs)
|
||||||
|
|
||||||
|
def values(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Overload values method to filter on typeclass first.
|
||||||
|
Args:
|
||||||
|
*args (any): Positional arguments passed along to values method.
|
||||||
|
**kwargs (any): Keyword arguments passed along to values method.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Queryset of values dictionaries, just filtered by typeclass first.
|
||||||
|
"""
|
||||||
|
return super(TypeclassManager, self).filter(db_typeclass_path=self.model.path).values(*args, **kwargs)
|
||||||
|
|
||||||
|
def values_list(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Overload values method to filter on typeclass first.
|
||||||
|
Args:
|
||||||
|
*args (any): Positional arguments passed along to values_list method.
|
||||||
|
**kwargs (any): Keyword arguments passed along to values_list method.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Queryset of value_list tuples, just filtered by typeclass first.
|
||||||
|
"""
|
||||||
|
return super(TypeclassManager, self).filter(db_typeclass_path=self.model.path).values_list(*args, **kwargs)
|
||||||
|
|
||||||
def _get_subclasses(self, cls):
|
def _get_subclasses(self, cls):
|
||||||
"""
|
"""
|
||||||
Recursively get all subclasses to a class.
|
Recursively get all subclasses to a class.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue