From: Guillaume Pellerin Date: Wed, 3 Feb 2016 16:54:08 +0000 (+0100) Subject: fix initial X-Git-Tag: 1.1~162 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=156af0966a1cffc2991e3d175c0afc0034eddec2;p=teleforma.git fix initial --- 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 +