def add_qualification(request): if request.method == 'POST': form = ScoreForm(request.POST) if form.is_valid(): form.save() qualifications_list = Score.objects.all() return render_to_response('qualifications.html',{'qualifications':qualifications_list}, context_instance=RequestContext(request)) else: form = ScoreForm() return render_to_response('qualifications.html', {'form':form}, context_instance = RequestContext(request))
def edit_qualification(request, id_qualification): qualification = Score.objects.get(pk = id_qualification) if request.method == 'POST': form = ScoreForm(request.POST, instance = qualification) if form.is_valid(): form.save() qualifications_list = qualification.objects.all() return render_to_response('qualifications.html',{'qualifications':qualifications_list}, context_instance=RequestContext(request)) else: form = ScoreForm(instance = qualification) return render_to_response('qualifications.html', {'form':form}, context_instance = RequestContext(request))