From 7fe6c91bed4e545ced0d76be8cb0e854b2e95ab0 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sat, 9 Jun 2018 19:01:36 +0200 Subject: [PATCH] Add a command that clean logs --- logs/management/__init__.py | 0 logs/management/commands/__init__.py | 0 logs/management/commands/log_clean.py | 11 +++++++++++ 3 files changed, 11 insertions(+) create mode 100644 logs/management/__init__.py create mode 100644 logs/management/commands/__init__.py create mode 100644 logs/management/commands/log_clean.py diff --git a/logs/management/__init__.py b/logs/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/logs/management/commands/__init__.py b/logs/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/logs/management/commands/log_clean.py b/logs/management/commands/log_clean.py new file mode 100644 index 0000000..238bb4a --- /dev/null +++ b/logs/management/commands/log_clean.py @@ -0,0 +1,11 @@ +from django.core.management.base import BaseCommand, CommandError +from logs.models import Entry + + +class Command(BaseCommand): + help = 'Generates the CSS files used by Pygments' + + def handle(self, *args, **options): + for e in Entry.objects.all(): + if not e.created: + e.delete()