Move django-based uncloud to top-level
This commit is contained in:
parent
0560063326
commit
95d43f002f
265 changed files with 0 additions and 0 deletions
23
uncloud_pay/management/commands/handle-overdue-bills.py
Normal file
23
uncloud_pay/management/commands/handle-overdue-bills.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
from uncloud_auth.models import User
|
||||
from uncloud_pay.models import Bill
|
||||
|
||||
from datetime import timedelta
|
||||
from django.utils import timezone
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Take action on overdue bills.'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
pass
|
||||
|
||||
def handle(self, *args, **options):
|
||||
users = User.objects.all()
|
||||
print("Processing {} users.".format(users.count()))
|
||||
for user in users:
|
||||
for bill in Bill.get_overdue_for(user):
|
||||
print("/!\ Overdue bill for {}, {} with amount {}"
|
||||
.format(user.username, bill.uuid, bill.amount))
|
||||
# TODO: take action?
|
||||
|
||||
print("=> Done.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue