26 lines
734 B
Python
26 lines
734 B
Python
from django import forms
|
|
from .models import ShiftRegistration, Helper
|
|
|
|
|
|
# placeholder form for simple submit button use cases so we get csrf protection
|
|
class EmptyForm(forms.Form):
|
|
pass
|
|
|
|
|
|
class NameField(forms.ModelChoiceField):
|
|
def label_from_instance(self, user):
|
|
return f"{user.name} ({(str(user.phone))[-3:]})"
|
|
|
|
|
|
class HelperShift(forms.Form):
|
|
helper = NameField(label="Helfer*in", queryset=Helper.objects.order_by("name"))
|
|
|
|
|
|
class BulkMessage(forms.Form):
|
|
message = forms.CharField(
|
|
label="Nachricht", widget=forms.Textarea(attrs={"class": "textarea"})
|
|
)
|
|
checked_in_only = forms.BooleanField(
|
|
label="Nur an Helfer*innen mit mindestens einem Check-in senden", required=False
|
|
)
|