django-model-utils/tests/managers.py
Adam Dobrawy ffa1a85dc7 Modernize Python syntax, add Python 3.8 (#398)
* Modernize Python syntax, add Python 3.8

* Update Python version & dist in TravisCI

* Add postgresql as addon

* Switch to psycopg2-binary

* Drop django.utils.six
2019-11-14 22:50:04 +06:00

13 lines
375 B
Python

from model_utils.managers import SoftDeletableQuerySet, SoftDeletableManager
class CustomSoftDeleteQuerySet(SoftDeletableQuerySet):
def only_read(self):
return self.filter(is_read=True)
class CustomSoftDeleteManager(SoftDeletableManager):
_queryset_class = CustomSoftDeleteQuerySet
def only_read(self):
return self.get_queryset().only_read()