mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Fix not allowing program times on event series (API/copy) (#5595)
* Fix not allowing program times on event series (API/copy) * Return 400 when reading endpoint in event series * add docs program times not available on event series * fix isort
This commit is contained in:
committed by
GitHub
parent
e2d9cbb41d
commit
d7b6856322
@@ -990,10 +990,11 @@ class Event(EventMixin, LoggedModel):
|
||||
ia.bundled_variation = variation_map[ia.bundled_variation.pk]
|
||||
ia.save(force_insert=True)
|
||||
|
||||
for ipt in ItemProgramTime.objects.filter(item__event=other).prefetch_related('item'):
|
||||
ipt.pk = None
|
||||
ipt.item = item_map[ipt.item.pk]
|
||||
ipt.save(force_insert=True)
|
||||
if not self.has_subevents and not other.has_subevents:
|
||||
for ipt in ItemProgramTime.objects.filter(item__event=other).prefetch_related('item'):
|
||||
ipt.pk = None
|
||||
ipt.item = item_map[ipt.item.pk]
|
||||
ipt.save(force_insert=True)
|
||||
|
||||
quota_map = {}
|
||||
for q in Quota.objects.filter(event=other, subevent__isnull=True).prefetch_related('items', 'variations'):
|
||||
|
||||
@@ -2311,6 +2311,8 @@ class ItemProgramTime(models.Model):
|
||||
end = models.DateTimeField(verbose_name=_("End"))
|
||||
|
||||
def clean(self):
|
||||
if self.item.event.has_subevents:
|
||||
raise ValidationError(_("You cannot use program times on an event series."))
|
||||
self.clean_start_end(start=self.start, end=self.end)
|
||||
super().clean()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user