Example #1
0
def sabtenam_karmand(request):
    if (request.POST):
        form = EmployeeForm(request.POST)
        if (form.is_valid()):
            form.save()
            form_test = EmployeeForm(request.POST)
            context_test = {}
            context_test.update({'emp_form': form_test})
            return render(request, 'fnc/sabtenam_karmand_review.html', context_test)
    else:
        form = EmployeeForm()
    context = {}
    context.update({'emp_form': form})
    return render(request, 'fnc/sabtenam_karmand.html', context)
Example #2
0
def karmand_detail_2(request, epId):
    employee = Employee.objects.get(id = epId)
    f = EmployeeForm(instance = employee)
    if (request.POST):
        f = EmployeeForm(request.POST, instance = employee)
        try:
            request.POST['gender'] = request.POST['gender'].encode('utf-8')
        except:
            pass
        if (f.is_valid()):
            f.save()
            return HttpResponseRedirect(reverse('fnc-karmandan'))
            # else :
    return render(request, 'fnc/karmand_edit.html', {'EditForm': f})