diff --git a/fiesta/apps/events/forms/event.py b/fiesta/apps/events/forms/event.py index 22423f28..4ebeb580 100644 --- a/fiesta/apps/events/forms/event.py +++ b/fiesta/apps/events/forms/event.py @@ -3,6 +3,9 @@ from django.forms import Field as FormField, modelform_factory, CharField, HiddenInput, ChoiceField from django.utils.translation import gettext_lazy as _ +from apps.sections.models import SectionMembership + + class AddEventForm(BaseModelForm): section_name = CharField(label=_("ESN section"), disabled=True) author_name = CharField(label=_("Author of the event"), disabled=True) @@ -41,8 +44,10 @@ class Meta: class UpdateEventForm(BaseModelForm): # section_name = CharField(label=_("ESN section"), disabled=True) # author_name = CharField(label=_("Author of the event"), disabled=True) + memberships_queryset = SectionMembership.objects.all() + membership_choices = [(membership.user.id, membership.user.full_name_official) for membership in memberships_queryset] - add_organizer = ChoiceField() + add_organizer = ChoiceField(choices=membership_choices, label=_("Add organizer"), required=False) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs)