Files
dss.api/spa/management/commands/create_notifications.py
2016-09-23 00:21:02 +01:00

15 lines
517 B
Python

from django.core.management.base import NoArgsCommand
from spa import models
class Command(NoArgsCommand):
def handle_noargs(self, **options):
try:
models.Notification.objects.all().delete()
act = models.Activity.objects.all().order_by('-id').select_subclasses()
for a in act:
print("Creating for: {0}".format(a))
a.create_notification(accept=True)
except Exception as ex:
print("Debug exception: %s" % ex.message)