コード例 #1
0
ファイル: views.py プロジェクト: Athul-cr/Online-car-rent
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")
コード例 #2
0
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")
コード例 #3
0
ファイル: views.py プロジェクト: Athul-cr/Online-car-rent
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)
コード例 #4
0
ファイル: views.py プロジェクト: Athul-cr/Online-car-rent
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)