forked from CGM_Public/pretix_original
* Vendor vue.js * Refactor item_group_by_category to support vouchers * Widget: Show product list * Widget: free prices * Widget: pictures and loading indicator * Widget: First iframe steps * Widget: Do not rerender iframe * Widget: Error handling * Improve widget * Widget: localization tech * Fix invoice style * Voucher attribute and waiting list * Add some iframe chrome * First step to namespaced carts * More isolation steps * More cart isolation things * More cart isolation things * Mobile stuff * Show cart on checkout pages * PayPal and Stripe support * Enable downloads * Locale handling * change text "save URL to this exact page" * Widget: voucher redemption * Widget: CSS * CSS: Responsive * Widget: CSS improvements * Widget: Add embedding code generator * Widget: Error messages and SSL check * First tests * Widget: tests * Don't use IDs in widgets * Widget: static files caching
59 lines
1.2 KiB
Python
59 lines
1.2 KiB
Python
from django.core.exceptions import ValidationError
|
|
from django.utils.deconstruct import deconstructible
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
|
|
class BlacklistValidator:
|
|
|
|
blacklist = []
|
|
|
|
def __call__(self, value):
|
|
# Validation logic
|
|
if value in self.blacklist:
|
|
raise ValidationError(
|
|
_('This slug has an invalid value: %(value)s.'),
|
|
code='invalid',
|
|
params={'value': value},
|
|
)
|
|
|
|
|
|
@deconstructible
|
|
class EventSlugBlacklistValidator(BlacklistValidator):
|
|
|
|
blacklist = [
|
|
'download',
|
|
'healthcheck',
|
|
'locale',
|
|
'control',
|
|
'redirect',
|
|
'jsi18n',
|
|
'metrics',
|
|
'_global',
|
|
'__debug__',
|
|
'api',
|
|
'events',
|
|
'csp_report',
|
|
'widget',
|
|
]
|
|
|
|
|
|
@deconstructible
|
|
class OrganizerSlugBlacklistValidator(BlacklistValidator):
|
|
|
|
blacklist = [
|
|
'download',
|
|
'healthcheck',
|
|
'locale',
|
|
'control',
|
|
'pretixdroid',
|
|
'redirect',
|
|
'jsi18n',
|
|
'metrics',
|
|
'_global',
|
|
'__debug__',
|
|
'about',
|
|
'api',
|
|
'csp_report',
|
|
'widget',
|
|
]
|