forked from larymak/Python-project-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.py
23 lines (22 loc) · 970 Bytes
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from django import forms
from .models import Student
class StudentForm(forms.ModelForm):
class Meta:
model = Student
fields = ['student_number', 'first_name', 'last_name', 'email', 'field_of_study', 'gpa']
labels = {
'student_number': 'Student Number',
'first_name': 'First Name',
'last_name': 'Last Name',
'email': 'Email',
'field_of_study': 'Field of Study',
'gpa': 'GPA'
}
widgets = {
'student_number': forms.NumberInput(attrs={'class': 'form-control'}),
'first_name': forms.TextInput(attrs={'class': 'form-control'}),
'last_name': forms.TextInput(attrs={'class': 'form-control'}),
'email': forms.EmailInput(attrs={'class': 'form-control'}),
'field_of_study': forms.TextInput(attrs={'class': 'form-control'}),
'gpa': forms.NumberInput(attrs={'class': 'form-control'}),
}