diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-11-19 22:56:06 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-11-19 22:56:06 +0200 |
commit | 858e2044b8ea51a47a863e1f316db24f7d57a648 (patch) | |
tree | dd6c9c5ff9803737462be4a7d72e31f1e8a1198c /servo/management/commands | |
parent | 72111556edd4c108033e454758434df63045c0b0 (diff) | |
download | Servo-858e2044b8ea51a47a863e1f316db24f7d57a648.tar.gz Servo-858e2044b8ea51a47a863e1f316db24f7d57a648.tar.bz2 Servo-858e2044b8ea51a47a863e1f316db24f7d57a648.zip |
Added clean orders
Diffstat (limited to 'servo/management/commands')
-rw-r--r-- | servo/management/commands/cleanorders.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/servo/management/commands/cleanorders.py b/servo/management/commands/cleanorders.py new file mode 100644 index 0000000..118b708 --- /dev/null +++ b/servo/management/commands/cleanorders.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from django.core.management.base import BaseCommand + +from servo.models import Order + + +class Command(BaseCommand): + + help = "Deletes empty service orders" + + def handle(self, *args, **options): + orders = Order.objects.filter(customer=None, + devices=None, + note=None, + serviceorderitem=None) + count = orders.count() + orders.delete() + print('%d orders deleted' % count) |