예제 #1
0
def update_view(request, id):
    e = Employee.objects.get(id=id)
    if request.method == "POST":
        f = EmployeeForm(request.POST, instance=e)
        if f.is_valid():
            f.save(commit=True)
        return redirect("/home")
    return render(request, 'myApp/update.html', {'e': e})
예제 #2
0
def update_view(request, id):
    e = Employee.objects.get(id=id)
    if request.method == 'POST':
        f = EmployeeForm(request.POST, instance=e)
        if f.is_valid():
            f.save(commit=True)
        return redirect("/")
    d = {'emp': e}
    return render(request, "myApp/update.html", d)
예제 #3
0
def view1(request):
    f = EmployeeForm()
    d = {'f': f}
    if request.method == "POST":
        f = EmployeeForm(request.POST)
        if f.is_valid():
            f.save(commit=True)
    return render(request, 'myApp/input.html', d)
예제 #4
0
def insert_view(request):
    f = EmployeeForm()
    if request.method == "POST":
        f = EmployeeForm(request.POST)
        if f.is_valid():
            f.save(commit=True)
        return redirect('/')
    d = {'form': f}
    return render(request, 'myApp/insert.html', d)
예제 #5
0
 def insert_view(request):
     f=EmployeeForm()
     if request.method=="POST":
         f=EmployeeForm(request.POST)
         if f.is_valid():
             f.save(commit=True)
             return redirect("/")
             d={'form':f}
             return render(request,'myApp/insert.html',d)
             def delete_view(request,id):
                 e=Employee.objects.get(id=id)
                 e.delete()
                 return redirect('/')
                 def update_view(request,id):
                     e=Employee.objects.get(id=id)
                     if request.method=='POST':
                         F=EmployeeForm(request.POST,instance=e)
                         if f.is_valid():
                             f.save(commit=True)
                             return redirect("/")
                             d={'emp':e}
                             return render(request,'myApp/update.htmal',d)