Check-in log: Add select2 for gate selection

This commit is contained in:
Raphael Michel
2023-03-10 15:21:25 +01:00
parent 440d1b5766
commit 5c8a3f18f3
4 changed files with 43 additions and 0 deletions

View File

@@ -2215,6 +2215,17 @@ class CheckinFilterForm(FilterForm):
self.fields['device'].label = _('Device')
self.fields['gate'].queryset = self.event.organizer.gates.all()
self.fields['gate'].widget = Select2(
attrs={
'data-model-select2': 'generic',
'data-select2-url': reverse('control:organizer.gates.select2', kwargs={
'organizer': self.event.organizer.slug,
}),
'data-placeholder': _('All gates'),
}
)
self.fields['gate'].widget.choices = self.fields['gate'].choices
self.fields['gate'].label = _('Gate')
self.fields['checkin_list'].queryset = self.event.checkin_lists.all()
self.fields['checkin_list'].widget = Select2(