def edu_edit_view(request, id = -1): if request.method == 'POST': f = EduForm(request.POST, instance=Education.objects.get(pk=id)) if f.is_valid(): f.save() return render_resume(request, tab='edu') elif id != -1: return render(request, 'edit/edu.html', { 'form': EduForm(instance=Education.objects.get(pk=id)), 'id': id }); return redirect('/resume')
def edu_view(request): if request.method == 'POST': f = EduForm(request.POST) if f.is_valid(): resume = Resume.objects.get(user=request.user) model = f.save(commit=False) model.resume = resume model.save() return render_resume(request, tab='edu') return redirect('/resume')