def exp_edit_view(request, id = -1): if request.method == 'POST': f = ExpForm(request.POST, instance=Experience.objects.get(pk=id)) if f.is_valid(): f.save() return render_resume(request, tab='exp') elif id != -1: return render(request, 'edit/exp.html', { 'form': ExpForm(instance=Experience.objects.get(pk=id)), 'id': id }); return redirect('/resume')
def exp_view(request): if request.method == 'POST': f = ExpForm(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='exp') return redirect('/resume')
def render_resume(request, tab='general'): resume = Resume.objects.get(user=request.user) return render(request, 'resume.html', { 'general_form': ResumeForm(instance=resume), 'skill_form': SkillForm(), 'experience_form': ExpForm(), 'education_form': EduForm(), 'language_form': LangForm(), 'skills': Skill.objects.filter(resume=resume), 'experience': Experience.objects.filter(resume=resume), 'education': Education.objects.filter(resume=resume), 'languages': Language.objects.filter(resume=resume), 'tab':tab })