mirror of
https://github.com/evennia/evennia.git
synced 2026-03-25 17:26:32 +01:00
Add annotate method to TypedManager to filter by typeclass appropriately.
This commit is contained in:
parent
8d8adbbc77
commit
df866fb3f3
1 changed files with 12 additions and 0 deletions
|
|
@ -619,6 +619,18 @@ class TypeclassManager(TypedObjectManager):
|
|||
"""
|
||||
return super(TypeclassManager, self).filter(db_typeclass_path=self.model.path).count()
|
||||
|
||||
def annotate(self, *args, **kwargs):
|
||||
"""
|
||||
Overload annotate method to first call .all() 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 _get_subclasses(self, cls):
|
||||
"""
|
||||
Recursively get all subclasses to a class.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue