예제 #1
0
파일: views.py 프로젝트: stianrincon/school
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))
예제 #2
0
파일: views.py 프로젝트: stianrincon/school
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))