def student_degree(request, st_id): degree = models.Degree.objects.filter(student_id=st_id) students = models.Student.objects.get(id=st_id) form_data = forms.DegreeRegistrar(request.POST or None) if form_data.is_valid(): d_degree = models.Degree() d_degree.student_degree = form_data.cleaned_data['student_degree'] d_degree.student_id = students d_degree.save() context = {'degree': degree, 'form_register': form_data} return render(request, 'degree.html', context)
def studentDegree(request, student_id): degrees = models.Degree.objects.filter(student_id=student_id) stuents = models.Student.objects.get(id=student_id) form_data = form.DegreeRegistrar(request.POST or None) msg = '' if form_data.is_valid(): degree = models.Degree() degree.student_degree = form_data.cleaned_data['student_drgee'] degree.student_id = stuents degree.save() msg = 'data is saved' context = {'degrees': degrees, 'formregister': form_data, 'msg': msg} return render(request, 'degree.html', context)
def degree(request, student_id): # return HttpResponse('this is degree of student id.'+ student_id) d = models.Degree.objects.filter(student_id=student_id) student = models.Student.objects.get(id=student_id) data = forms.DegreeRegistar(request.POST or None) msg = '' if data.is_valid(): degree = models.Degree() degree.student_degree = data.cleaned_data['student_degree'] degree.student_id = student degree.save() msg = 'data saved' context = {'d': d, 'data': data, 'msg': msg} return render(request, 'd.html', context)