# Imports
from django.db import models
# Exports
__all__ = (
"LockedManager",
)
# Managers
[docs]class LockedManager(models.Manager):
"""Works in conjunction with ``LockedModel`` to identify locked records.
.. note::
If you want to always work with locked records, ``LockedManager`` must
be the default manager.
"""
[docs] def locked(self):
"""Get only locked records."""
return self.get_queryset().filter(is_locked=True)
[docs] def unlocked(self):
"""Get only unlocked records."""
return self.get_queryset().filter(is_locked=False)