File: cleanup.py

package info (click to toggle)
django-cleanup 5.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 144 kB
  • sloc: python: 270; makefile: 3
file content (18 lines) | stat: -rw-r--r-- 438 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'''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