mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Improved device validation
This commit is contained in:
@@ -173,6 +173,13 @@ class DeviceForm(forms.ModelForm):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['limit_events'].queryset = organizer.events.all()
|
||||
|
||||
def clean(self):
|
||||
d = super().clean()
|
||||
if not d['all_events'] and not d['limit_events']:
|
||||
raise ValidationError(_('Your device will not have access to anything, please select some events.'))
|
||||
|
||||
return d
|
||||
|
||||
class Meta:
|
||||
model = Device
|
||||
fields = ['name', 'all_events', 'limit_events']
|
||||
|
||||
Reference in New Issue
Block a user