mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 17:56:32 +01:00
Merge pull request #1631 from TehomCD/fix_annotate_typed_manager
Fix TypeclassManager filtering for annotate, values, values_list methods
This commit is contained in:
commit
f0ce2c8c0a
1 changed files with 36 additions and 0 deletions
|
|
@ -619,6 +619,42 @@ class TypeclassManager(TypedObjectManager):
|
|||
"""
|
||||
return super(TypeclassManager, self).filter(db_typeclass_path=self.model.path).count()
|
||||
|
||||
def annotate(self, *args, **kwargs):
|
||||
"""
|
||||
Overload annotate method to filter on typeclass before annotating.
|
||||
Args:
|
||||
*args (any): Positional arguments passed along to queryset annotate method.
|
||||
**kwargs (any): Keyword arguments passed along to queryset annotate method.
|
||||
|
||||
Returns:
|
||||
Annotated queryset.
|
||||
"""
|
||||
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):
|
||||
"""
|
||||
Recursively get all subclasses to a class.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue