Files
RasadDam_Backend/apps/core/manager.py

16 lines
464 B
Python
Raw Normal View History

from django.db import models
class SoftDeleteManager(models.Manager):
""" manager for get all records with trash=False in whole project """
2025-11-01 08:46:00 +03:30
def get_queryset(self):
return super().get_queryset().filter(trash=False)
def all_with_deleted(self):
""" get all records, also deleted ones """
return super().get_queryset().all()
2025-11-01 08:46:00 +03:30
def get_by_natural_key(self, username):
return self.get_queryset().get(username=username)