Add a command that clean logs
This commit is contained in:
parent
0c29381351
commit
7fe6c91bed
3 changed files with 11 additions and 0 deletions
0
logs/management/__init__.py
Normal file
0
logs/management/__init__.py
Normal file
0
logs/management/commands/__init__.py
Normal file
0
logs/management/commands/__init__.py
Normal file
11
logs/management/commands/log_clean.py
Normal file
11
logs/management/commands/log_clean.py
Normal file
|
@ -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()
|
Loading…
Reference in a new issue