def BrandDel(request, pk): dele = Brand.objects.get(id=pk) dele.delete() qs = BrandFormm() context = {} context['del'] = qs qs = Brand.objects.all() context['brand'] = qs return redirect("createBrand")
def DeleteCar(request, pk): dele = Brand.objects.get(id=pk) dele.delete() qs = BrandFormm() context = {} context['del'] = qs qs = Brand.objects.all() context['delcar'] = qs return redirect("Carcreate")
def createBrand(request): form = BrandFormm() context = {} context['form'] = form qs = Brand.objects.all() context['qs'] = qs if request.method == "POST": form = BrandFormm(request.POST) if form.is_valid(): form.save() return redirect("createBrand") return render(request, "Rent/CreateBrand.html", context)
def BrandEdit(request, pk): form = Brand.objects.get(id=pk) form = BrandFormm(instance=form) context = {} context['form'] = form if request.method == "POST": form = Brand.objects.get(id=pk) form = BrandFormm(instance=form, data=request.POST) if form.is_valid(): form.save() return redirect("createBrand") return render(request, "Rent/BrandEdit.html", context)