From c6ac83b9108e1139f5c982e9ffda47525679fd25 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 1 Jun 2017 19:45:55 +0200 Subject: Add the ability to scheduled administration task inside Django admin --- .../management/commands/ishtar_excute_admin_tasks.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ishtar_common/management/commands/ishtar_excute_admin_tasks.py (limited to 'ishtar_common/management/commands/ishtar_excute_admin_tasks.py') diff --git a/ishtar_common/management/commands/ishtar_excute_admin_tasks.py b/ishtar_common/management/commands/ishtar_excute_admin_tasks.py new file mode 100644 index 000000000..3fe66ad3b --- /dev/null +++ b/ishtar_common/management/commands/ishtar_excute_admin_tasks.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from django.core.management.base import BaseCommand, CommandError + +from ishtar_common import models + + +class Command(BaseCommand): + help = "./manage.py ishtar_execute_admin_tasks\n\n"\ + "Launch pending administration tasks." + + def handle(self, *args, **options): + for task in models.AdministrationTask.objects.filter(state='S').all(): + task.execute() -- cgit v1.2.3