Metadata-Version: 1.1
Name: django-tables-cleaner
Version: 0.0.5
Summary: A Django app which can remove (and optionally archive) oldest records from specific db tables.
Home-page: https://brainstorm.it/
Author: Mario Orlandi
Author-email: morlandi@brainstorm.it
License: BSD License
Description-Content-Type: UNKNOWN
Description: =====================
        django-tables-cleaner
        =====================
        
        `tables_cleaner` is a Django app which can remove (and optionally archive)
        oldest records from specific db tables.
        
        Quick start
        -----------
        
        1. Installation::
        
            pip install git+https://github.com/morlandi/django-tables-cleaner
        
        2. Add "tables_cleaner" to your INSTALLED_APPS setting like this::
        
            INSTALLED_APPS = [
                ...
                'tables_cleaner',
            ]
        
        3. Run the management command periodically (i.e. with cron) ::
        
            python manage.py clean_tables
        
        Usage
        -----
        
        ::
        
            usage: manage.py clean_tables [-h] [--database DATABASE] [-n] [--vacuum]
                                          [--version] [-v {0,1,2,3}] [--settings SETTINGS]
                                          [--pythonpath PYTHONPATH] [--traceback]
                                          [--no-color]
        
            optional arguments:
              -h, --help            show this help message and exit
              --database DATABASE   Nominates a specific database to load fixtures into.
                                    Defaults to the "default" database.
              -n, --dry-run         Don't actually delete records (default: False)
              --vacuum              Run VACUUM FULL after deletion (Postgresql only)
              --version             show program's version number and exit
              -v {0,1,2,3}, --verbosity {0,1,2,3}
                                    Verbosity level; 0=minimal output, 1=normal output,
                                    2=verbose output, 3=very verbose output
              --settings SETTINGS   The Python path to a settings module, e.g.
                                    "myproject.settings.main". If this isn't provided, the
                                    DJANGO_SETTINGS_MODULE environment variable will be
                                    used.
              --pythonpath PYTHONPATH
                                    A directory to add to the Python path, e.g.
                                    "/home/djangoprojects/myproject".
              --traceback           Raise on CommandError exceptions
              --no-color            Don't colorize the command output.
        
        Settings
        --------
        
        TABLES_CLEANER_TABLES
            The list of models to be cleaned;
        
            options:
        
                - keep_records: n. of most recent records to be preserved; 0=unused
                - keep_since_days: always preserve records more recent than this; 0=unused
                - keep_since_hourse: always preserve records more recent than this; 0=unused
        
        Example::
        
            TABLES_CLEANER_TABLES = [
                {
                    'model': 'backend.log',
                    'keep_records': 1000,
                    'keep_since_days': 1,
                    'keep_since_hours': 0,
                }, {
                    'model': 'tasks.updatedevicetask',
                    'keep_records': 100,
                    'keep_since_days': 0,
                    'keep_since_hours': 12,
                    'get_latest_by': 'created',
                },
            ]
        
        
        **get_latest_by** attribute is optional; if not supplied, Model's Meta get_latest_by
        is used instead.
        
        
        
        
        History
        =======
        
        v0.0.5
        ------
        * Fix for Django 2.x: call super() from Command.__init__() as required
        
        v0.0.4
        ------
        * Customizable 'get_latest_by' attribute
        * Remove EmptyResultSet import which is not available in older versions of Django
        
        v0.0.3
        ------
        * Setup fix
        
        v0.0.2
        ------
        * First working implementation
        
        v0.0.1
        ------
        * Initial setup
        
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.1
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
