mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-10 03:14:58 -04:00
Add a form for choosing areas
Picking multiple areas at once definitely feels like a need, so let’s make them checkboxes.
This commit is contained in:
@@ -1809,3 +1809,18 @@ class AcceptAgreementForm(StripWhitespaceForm):
|
||||
float(field.data)
|
||||
except (TypeError, ValueError):
|
||||
raise ValidationError("Must be a number")
|
||||
|
||||
|
||||
class BroadcastAreaForm(StripWhitespaceForm):
|
||||
|
||||
areas = MultiCheckboxField('Choose areas to broadcast to')
|
||||
|
||||
def __init__(self, choices, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.areas.choices = choices
|
||||
|
||||
@classmethod
|
||||
def from_library(cls, library):
|
||||
return cls(choices=[
|
||||
(area.id, area.name) for area in sorted(library)
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user