Skip to content

Commit

Permalink
forms
Browse files Browse the repository at this point in the history
  • Loading branch information
petrceska committed Oct 5, 2023
1 parent c2e25f0 commit 48df26f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fiesta/apps/events/forms/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

This comment has been minimized.

Copy link
@thejoeejoee

thejoeejoee Oct 5, 2023

Member

koukni na ModelChoiceField, tomu můžeš předat rovnou QS


def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down

0 comments on commit 48df26f

Please sign in to comment.