File: managers.py

package info (click to toggle)
django-model-utils 4.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 552 kB
  • sloc: python: 3,438; makefile: 181
file content (13 lines) | stat: -rw-r--r-- 375 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
from model_utils.managers import SoftDeletableManager, SoftDeletableQuerySet


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()