Source code for superdjango.db.archived.managers

# Imports

from django.db import models

# Exports

__all__ = (
    "ArchivedManager",
)

# Managers


[docs]class ArchivedManager(models.Manager): """Automatically filters out archived records."""
[docs] def archived(self): """Specifically select archived records.""" # TODO: Should archived() method use _chain() or _clone() instead of _queryset_class()? qs = self._queryset_class(model=self.model, using=self._db, hints=self._hints) return qs.filter(is_archived=True)
[docs] def unarchived(self): """Specifically select unarchived records.""" return super().get_queryset().filter(is_archived=False)