Manager
class¶
edgy.Manager
¶
Manager(*, owner=None, inherit=True, name='', instance=None)
Bases: BaseManager
A concrete implementation of BaseManager, serving as the default manager for Edgy Models.
This manager provides the core functionality for querying model instances. Custom managers should inherit from this class to extend or modify query behavior.
Example
from edgy import Manager, Model
class MyCustomManager(Manager):
# Custom manager logic can be added here
pass
class MyOtherManager(Manager):
# Another custom manager
pass
class MyModel(Model):
query = MyCustomManager() # Assigning a custom manager
active = MyOtherManager() # Assigning another custom manager
# ... model fields and other definitions
Initializes the BaseManager.
PARAMETER | DESCRIPTION |
---|---|
owner
|
The owner model class associated with this manager. Defaults to None.
TYPE:
|
inherit
|
A boolean indicating whether the manager should be inherited by subclasses. Defaults to True.
TYPE:
|
name
|
The name of the manager instance. Defaults to an empty string.
TYPE:
|
instance
|
The model instance associated with this manager, if it's an instance manager. Defaults to None.
TYPE:
|
Source code in edgy/core/db/models/managers.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
model_class
property
¶
model_class
Provides a legacy name for the owner property.
RETURNS | DESCRIPTION |
---|---|
Any
|
The owner model class.
TYPE:
|
get_queryset
¶
get_queryset()
Returns a QuerySet object tailored for the manager's owner model.
This method determines the appropriate schema and database to use for the queryset, considering whether the manager is bound to a model class or a specific instance.
RETURNS | DESCRIPTION |
---|---|
QuerySet
|
An instance of QuerySet configured for the owner model.
TYPE:
|
Source code in edgy/core/db/models/managers.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|