2015-10-03 19:50:24 +00:00
|
|
|
from django.core.exceptions import ValidationError
|
2023-10-24 16:59:02 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2015-10-03 19:50:24 +00:00
|
|
|
|
|
|
|
from orchestra.utils.apps import isinstalled
|
|
|
|
|
|
|
|
|
|
|
|
def validate_website_saas_directives(app):
|
|
|
|
def validator(enabled, app=app):
|
|
|
|
if enabled and isinstalled('orchestra.contrib.websites'):
|
|
|
|
from orchestra.contrib.websites import settings
|
|
|
|
if app not in settings.WEBSITES_SAAS_DIRECTIVES:
|
|
|
|
raise ValidationError(_("Allow custom URL is enabled for '%s', "
|
|
|
|
"but has no associated WEBSITES_SAAS_DIRECTIVES" % app))
|
|
|
|
return validator
|