diff --git a/src/pretix/plugins/badges/views.py b/src/pretix/plugins/badges/views.py index 47e0b7dc9..e5152eb64 100644 --- a/src/pretix/plugins/badges/views.py +++ b/src/pretix/plugins/badges/views.py @@ -227,7 +227,7 @@ class LayoutEditorView(BaseEditorView): return self.layout.background.url if self.layout.background else self.get_default_background() def save_background(self, f: CachedFile): - if self.layout.background: + if self.layout.background and BadgeLayout.objects.filter(background=self.layout.background).count() == 1: self.layout.background.delete() self.layout.background.save('background.pdf', f.file) diff --git a/src/pretix/plugins/ticketoutputpdf/views.py b/src/pretix/plugins/ticketoutputpdf/views.py index aa032126d..0a1e38375 100644 --- a/src/pretix/plugins/ticketoutputpdf/views.py +++ b/src/pretix/plugins/ticketoutputpdf/views.py @@ -282,7 +282,7 @@ class LayoutEditorView(BaseEditorView): return self.layout.background.url if self.layout.background else self.get_default_background() def save_background(self, f: CachedFile): - if self.layout.background: + if self.layout.background and TicketLayout.objects.filter(background=self.layout.background).count() == 1: self.layout.background.delete() self.layout.background.save('background.pdf', f.file) invalidate_cache.apply_async(kwargs={'event': self.request.event.pk, 'provider': 'pdf'})