Пример #1
0
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')
Пример #2
0
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')