volunteers: filter activities per conference
This commit is contained in:
parent
111e5241c7
commit
1af6ada49d
|
@ -457,6 +457,11 @@ class VolunteerForm(forms.ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.conference = kwargs.pop('conference')
|
self.conference = kwargs.pop('conference')
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
activities = Activity.objects.filter(site=self.conference.site)
|
||||||
|
if activities.exists():
|
||||||
|
self.fields['activities'].queryset = activities
|
||||||
|
else:
|
||||||
|
del self.fields['activities']
|
||||||
|
|
||||||
# we should manually check (site, email) uniqueness as the site is not part of the form
|
# we should manually check (site, email) uniqueness as the site is not part of the form
|
||||||
def clean_email(self):
|
def clean_email(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user