Hi everyone,
I am working on a small student application.
I designed a table for storing students' information in which those fields of information are requested at the first registration and those can be updated later or updated during the process. For example, a student's information can update in the process by putting on-hold (update the onhold field) in case that student has been absent for 3 weeks.
The attached file contains my code.
When I fill out the form and submit it, it opens a new form without safe my information.
I also try to create the form directly from the model and send it, but it still not working (saying that there is a mandatory field even when I filled all the fields)
###form.py
class StudentRegistrationForm(ModelForm):
class Meta:
model = Student
fields = "__all__"
###view.py
def addStudent(request):
form = StudentRegistrationForm()
if request.method == "POST":
form = StudentRegistrationForm(request.POST)
if form.is_valid():
form.save()
return redirect('listStudents')
return render(request, 'students_management_app/student_template/addStudent.html', {'form': form})
Thank you for your support
Eric