Models

class purge.models.DatabasePurger(*args, **kwargs)[source]

Represents a purging action on a set of database tables.

exception DoesNotExist
exception MultipleObjectsReturned
purge()[source]

If this purger is enabled, purge the selected tables by age/quantity depending on the configuration.

classmethod purge_all()[source]

Helper for running purge on all of the DatabasePurger’s.

selected_tables

Getter to display the selected tables in the admin UI.

class purge.models.FilePurger(id, name, enabled, file_pattern, directory, recursive_search, delete_by_filename, filename_date_year_first, filename_date_day_first, delete_by_atime, delete_by_mtime, delete_by_ctime, age_in_days)[source]
exception DoesNotExist
exception MultipleObjectsReturned
filename_is_older_than(filename, dt)[source]

Extract the datetime object from a filename and check it to see if it is too old.

purge(directory=None)[source]

If this purger is enabled, evaluate the date and call the recursive purge method.

classmethod purge_all()[source]

Helper for running purge on all of the FilePurger’s.

purge_recursive(dt, directory=None)[source]

Purge files in this directory that match the criteria, and be recursive if that option is selected.