Refactor: split code into several django apps (we call them modules).

This commit is contained in:
2018-12-13 14:47:58 +01:00
parent c23dc33d4e
commit 0d5a8c65e3
81 changed files with 739 additions and 332 deletions

View File

@@ -4,6 +4,7 @@ from django.apps import apps
from django.utils import timezone
from . import emails
from .utils import get_users_by_role
logger = logging.getLogger(__name__)
@@ -143,7 +144,6 @@ class BasicWorkflow(object):
recipients = [event.owner]
if event.is_flagged('submitted'):
# If the event is already submitted, add managers to the recipients.
from .utils import get_users_by_role
recipients += get_users_by_role('manage_all')
recipients += get_users_by_role('manage_{}'.format(event.sport.lower()))
if event.is_flagged('accepted'):
@@ -174,7 +174,6 @@ class BasicWorkflow(object):
# Inform managers that they have to accept the event.
# Also create OneClickActions for all of them and add the link to the mail,
# so they can accept the event with a click into the mail.
from .utils import get_users_by_role
recipients = get_users_by_role('manage_all')
recipients += get_users_by_role('manage_{}'.format(event.sport.lower()))
OneClickAction = app_config.get_model('OneClickAction')
@@ -195,7 +194,6 @@ class BasicWorkflow(object):
# Inform publishers that they have to publish the event.
# Also create OneClickActions for all of them and add the link to the mail,
# so they can confirm the publication with a click into the mail.
from .utils import get_users_by_role
recipients = get_users_by_role('publish_incremental')
OneClickAction = app_config.get_model('OneClickAction')
for recipient in recipients: