mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Improved device validation
This commit is contained in:
@@ -173,6 +173,13 @@ class DeviceForm(forms.ModelForm):
|
|||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.fields['limit_events'].queryset = organizer.events.all()
|
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:
|
class Meta:
|
||||||
model = Device
|
model = Device
|
||||||
fields = ['name', 'all_events', 'limit_events']
|
fields = ['name', 'all_events', 'limit_events']
|
||||||
|
|||||||
Reference in New Issue
Block a user