@@ -10,6 +10,31 @@ class LoginForm(forms.Form):
1010 widget = forms .PasswordInput (render_value = True , attrs = {'placeholder' : 'Enter your password' }),
1111 label = 'Password' )
1212
13+
14+ class CreateStudentForm (forms .Form ):
15+ def __init__ (self , * args , ** kwargs ):
16+ choices = kwargs .pop ('branch_choices' , ())
17+ super ().__init__ (* args , ** kwargs )
18+ self .fields ['branch' ].choices = choices
19+
20+ id = forms .CharField (max_length = 15 , label = 'USN' )
21+ email = forms .EmailField (max_length = 254 , label = 'Email' )
22+ name = forms .CharField (max_length = 100 , label = 'Name' )
23+ branch = forms .ChoiceField (choices = (), label = 'Branch' )
24+ current_sem = forms .IntegerField (initial = 1 , min_value = 1 , label = 'Student Semester' )
25+
26+ class CreateStaffForm (forms .Form ):
27+ def __init__ (self , * args , ** kwargs ):
28+ choices = kwargs .pop ('branch_choices' , ())
29+ super ().__init__ (* args , ** kwargs )
30+ self .fields ['branch' ].choices = choices
31+
32+ id = forms .CharField (max_length = 15 , label = 'USN' )
33+ email = forms .EmailField (max_length = 254 , label = 'Email' )
34+ name = forms .CharField (max_length = 100 , label = 'Name' )
35+ branch = forms .ChoiceField (choices = (), label = 'Branch' )
36+
37+
1338class EditStudentForm (forms .Form ):
1439 name = forms .CharField (max_length = 254 , label = 'Name' )
1540 # email = forms.EmailField(max_length=254, label='Email')
@@ -19,6 +44,7 @@ class EditStudentForm(forms.Form):
1944 branch = forms .CharField (max_length = 64 , label = 'Branch' )
2045 current_sem = forms .IntegerField (label = 'Current Semester' )
2146
47+
2248class EditStaffForm (forms .Form ):
2349 name = forms .CharField (max_length = 254 , label = 'Name' )
2450 branch = forms .CharField (max_length = 64 , label = 'Branch' )
0 commit comments