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)
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)
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)
def get(self, request): form = MakeForm() ctx = {'form': form} return render(request, self.template, ctx)
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)
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)