mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Add filter for revoked devices (#2372)
Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
@@ -2018,6 +2018,15 @@ class DeviceFilterForm(FilterForm):
|
||||
],
|
||||
required=False,
|
||||
)
|
||||
state = forms.ChoiceField(
|
||||
label=_('Device status'),
|
||||
choices=[
|
||||
('', _('All devices')),
|
||||
('active', _('Active devices')),
|
||||
('revoked', _('Revoked devices'))
|
||||
],
|
||||
required=False
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
request = kwargs.pop('request')
|
||||
@@ -2047,6 +2056,11 @@ class DeviceFilterForm(FilterForm):
|
||||
if fdata.get('gate'):
|
||||
qs = qs.filter(gate=fdata['gate'])
|
||||
|
||||
if fdata.get('state') == 'active':
|
||||
qs = qs.filter(revoked=False)
|
||||
elif fdata.get('state') == 'revoked':
|
||||
qs = qs.filter(revoked=True)
|
||||
|
||||
if fdata.get('ordering'):
|
||||
qs = qs.order_by(self.get_order_by())
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user