def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) newid = Functions.getNewId(Enrolment, 'ENR', "{:07}") self.fields["code"].initial = newid SESSION = Functions.SessionList() self.fields["session"] = forms.ChoiceField( choices=SESSION, required=False, widget=forms.Select(attrs={'class': 'form-control p-input'})) SEMESTERNAME = Functions.getSemesterAlias() self.fields["semesterName"] = forms.ChoiceField( label='Semester Name', choices=SEMESTERNAME, required=False, widget=forms.Select(attrs={'class': 'form-control p-input'})) SEMESTERTYPE = Functions.getSemestersList() self.fields["semesterType"] = forms.ChoiceField( label='Semester Type', choices=SEMESTERTYPE, required=False, widget=forms.Select(attrs={'class': 'form-control p-input'})) LEVEL = Functions.getStudentLevels() self.fields["level"] = forms.ChoiceField( choices=LEVEL, required=False, widget=forms.Select(attrs={'class': 'form-control p-input'}))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) newid = Functions.getNewId(TableRegister, 'TBL', "{:07}") self.fields["code"].initial = newid SESSION = Functions.SessionList() self.fields["session"] = forms.ChoiceField(initial=Functions.getSettingsData('session'), choices=SESSION, required=True, widget=forms.Select(attrs={'class':'form-control p-input'})) SEMESTERNAME = Functions.getSemesterAlias() self.fields["semestername"] = forms.ChoiceField(label='Semester', initial=Functions.getSettingsData('semname'), choices=SEMESTERNAME, required=not(Functions.getSemesterReq()), widget=forms.Select(attrs={'class':'form-control p-input'})) SEMESTERTYPE = Functions.getSemestersList() self.fields["semestertype"] = forms.ChoiceField(label='Semester', initial=Functions.getSettingsData('semtype'), choices=SEMESTERTYPE, required=Functions.getSemesterReq(), widget=forms.Select(attrs={'class':'form-control p-input'}))