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})
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)
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)
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 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)