Files
notifications-admin/app/url_converters.py
Chris Hill-Scott 154d4bdb85 Allow adding broadcast templates
At the moment the page is the same as for text message templates,
except:
- different H1
- no guidance about personalisation, links, etc (until we decide how
  these should work)

For now you won’t be able to really create a broadcast template, because
the API doesn’t support it (the API will respond with a 400). But that’s
OK because no real services have the broadcast permission yet.

This required a bit of refactoring of how we check which template types
a service can use, because there were some hard-coded assumptions about
emails and text messages.
2020-07-01 17:17:46 +01:00

28 lines
628 B
Python

from werkzeug.routing import BaseConverter
from app.models.feedback import (
GENERAL_TICKET_TYPE,
PROBLEM_TICKET_TYPE,
QUESTION_TICKET_TYPE,
)
from app.models.service import Service
class TemplateTypeConverter(BaseConverter):
regex = '(?:{})'.format('|'.join(Service.TEMPLATE_TYPES))
class TicketTypeConverter(BaseConverter):
regex = f'(?:{PROBLEM_TICKET_TYPE}|{QUESTION_TICKET_TYPE}|{GENERAL_TICKET_TYPE})'
class LetterFileExtensionConverter(BaseConverter):
regex = '(?:pdf|png)'
class SimpleDateTypeConverter(BaseConverter):
regex = r'([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))'