Exemplo n.º 1
0
    def post(self, request):
        form = MakeForm(request.POST)
        if not form.is_valid():
            ctx = {'form': form}
            return render(request, self.template, ctx)

        make = form.save()
        return redirect(self.success_url)
Exemplo n.º 2
0
    def post(self, request, pk):
        make = get_object_or_404(self.model, pk=pk)
        form = MakeForm(request.POST, instance=make)
        if not form.is_valid():
            ctx = {'form': form}
            return render(request, self.template, ctx)

        form.save()
        return redirect(self.success_url)
Exemplo n.º 3
0
 def get(self, request, pk):
     make = get_object_or_404(self.model, pk=pk)
     form = MakeForm(instance=make)
     ctx = {'make': make}
     return render(request, self.template, ctx)
Exemplo n.º 4
0
 def get(self, request):
     form = MakeForm()
     ctx = {'form': form}
     return render(request, self.template, ctx)
Exemplo n.º 5
0
 def get(self, request, pk) :
     breed = get_object_or_404(self.model, pk=pk)
     form = MakeForm(instance=breed)
     count = { 'breed': breed }
     return render(request, self.template, count)
Exemplo n.º 6
0
 def get(self, request, pk):
     breed = get_object_or_404(self.model, pk=pk)
     form = MakeForm(instance=breed)
     ctx = {'form': form}
     return render(request, self.template, ctx)