'Django MultipleChoiceField field with filter
what should I write here to filter participants by event ID forms.py
participants = forms.ModelChoiceField(queryset=Participant.objects.none(), empty_label=None,),
so that I do not write to the queryset, I get all participants from all events. And I need to see those participants who sent an application for this event
view.py
form = EventForm(request.POST or None, instance=event)
form.fields['participants'].queryset = Participant.objects.filter(event_id=Event.pk)
would be very grateful for help
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
