django-model-utils/tests/managers.py
Maarten ter Huurne 68a4c14c74 Auto-generate manager implementation for CustomSoftDelete
Besides requiring less code, this also allows the django-stubs
mypy plugin to automatically generate a type-annotated version
of the manager.

Unfortunately, the plugin does not put a `ClassVar` annotation
on `objects`, which is why we need the suppression.
2024-04-16 04:02:12 +02:00

6 lines
178 B
Python

from model_utils.managers import SoftDeletableQuerySet
class CustomSoftDeleteQuerySet(SoftDeletableQuerySet):
def only_read(self):
return self.filter(is_read=True)