from django.db import models


class SoftDeleteManager(models.Manager):
    """ manager for get all records with trash=False in whole project """

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

    def get_by_natural_key(self, username):
        return self.get_queryset().get(username=username)
