How to do in django to return with the current page after the user insert their data (request.post)
scenario:
If the teacher insert the grades of their students, the current page will reload or refresh.
I don't know if I can achieve it by using redirect.
def grades(request):
V_insert_data = StudentSubjectGrade(
...
)
V_insert_data.save()
//redirect the same page
def teacher(request):
if request.method != 'POST':
raise Http404('Only POSTs are allowed')
try:
......
return render(request, 'Homepage/index.html')
except EmployeeUser.DoesNotExist:
messages.warning(request, 'Your Username and password are Incorrect.')
….
return render(request, 'Homepage/TeacherLogin.html')
urls.py
path('teacher/', Homepage.views.teacher, name='teacher'),
path('grades/', Homepage.views.grades, name='grades'),
this is the error i get
UPDATE
when I change my
response = redirect(teacher)
return response
to this
return redirect(reverse('teacher'))
i get the same result
UPDATE again
when I tried this
def grades(request):
V_insert_data = StudentSubjectGrade(
...
)
V_insert_data.save()
return HttpResponseRedirect(request.path_info)
I get this error
ive already clear my cookies but still this error appear

