Refs #654 -- Add writable API for subevents (#1217)

- [x] Write operations for subevents
- [x] Tests
- [x] Documentation
This commit is contained in:
Martin Gross
2019-03-21 21:40:59 +01:00
committed by Raphael Michel
parent 516fab52da
commit ca7d55082b
6 changed files with 817 additions and 8 deletions

View File

@@ -936,6 +936,18 @@ class SubEvent(EventMixin, LoggedModel):
if self.event:
self.event.cache.clear()
@staticmethod
def clean_items(event, items):
for item in items:
if event != item.event:
raise ValidationError(_('One or more items do not belong to this event.'))
@staticmethod
def clean_variations(event, variations):
for variation in variations:
if event != variation.item.event:
raise ValidationError(_('One or more variations do not belong to this event.'))
def generate_invite_token():
return get_random_string(length=32, allowed_chars=string.ascii_lowercase + string.digits)