Generateurv2/backend/env/lib/python3.10/site-packages/django_cleanup/cleanup.py
2022-06-24 17:14:37 +02:00

19 lines
438 B
Python

'''Public utilities'''
from .cache import (
get_mangled_ignore as _get_mangled_ignore, make_cleanup_cache as _make_cleanup_cache)
__all__ = ['refresh', 'cleanup_ignore']
def refresh(instance):
'''Refresh the cache for an instance'''
return _make_cleanup_cache(instance)
def ignore(cls):
'''Mark a model to ignore for cleanup'''
setattr(cls, _get_mangled_ignore(cls), None)
return cls
cleanup_ignore = ignore