From 156af0966a1cffc2991e3d175c0afc0034eddec2 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Wed, 3 Feb 2016 17:54:08 +0100 Subject: [PATCH] fix initial --- teleforma/forms.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/teleforma/forms.py b/teleforma/forms.py index cca6fc74..6d8b67f7 100644 --- a/teleforma/forms.py +++ b/teleforma/forms.py @@ -65,6 +65,8 @@ class StudentInline(InlineFormSet): fields = ['iej', 'period', 'procedure', 'written_speciality', 'oral_speciality', 'oral_1', ] - def __init__(self, *args, **kwargs): - super(StudentInline,self ).__init__(*args,**kwargs) # populates the post - self.fields['procedure'].queryset = Course.objects.filter(name__in='civil') + def get_initial(self): + initial = super(StudentInline,self ).get_initial() + initial['procedure'].queryset = Course.objects.filter(title__contains='civil') + return initial + -- 2.39.5