def post(self, request, *args, **kwargs): form = StatusForm(data=request.POST) if form.is_valid(): Status.objects.create(name=form.cleaned_data['name']) return redirect('index') else: return render(request, 'status_add.html', context={'form': form})
def post(self, request, *args, **kwargs): form = StatusForm(data=request.POST) if form.is_valid(): Status.objects.create(status=form.cleaned_data['status'], ) return redirect('webapp:status_index') else: return render(request, 'status/create_status.html', context={'form': form})
def statuses_create_view(request, *args, **kwargs): if request.method == 'GET': form = StatusForm() return render(request, 'create_status.html', context={'form': form}) elif request.method == 'POST': form = StatusForm(data=request.POST) if form.is_valid(): Status.objects.create(type=form.cleaned_data['status']) return redirect('status_ls') else: return render(request, 'create_status.html', context={'form': form})
def post(self, request, *args, **kwargs): list = get_object_or_404(Status, pk=kwargs.get('pk')) form = StatusForm(data=request.POST) if form.is_valid(): list.name = form.cleaned_data['name'] list.save() return redirect('index') else: return render(request, 'status_update.html', context={ 'form': form, 'list': list })
def statuses_edit_view(request, pk): statuses = get_object_or_404(Status, pk=pk) if request.method == 'GET': form = StatusForm(data={'status' : statuses.status}) return render(request, 'update_status.html', context={'form': form, 'status': statuses}) elif request.method == 'POST': form = StatusForm(data=request.POST) if form.is_valid(): statuses.status = request.POST.get('status') statuses.save() return redirect('status_ls') else: return render(request, 'update_status.html', context={'status': statuses, 'form': form}) return redirect('status_ls')
def post(self, request, *args, **kwargs): status_pk = kwargs.get('pk') status = get_object_or_404(Status, pk=status_pk) form = StatusForm(data=request.POST) if form.is_valid(): status.status = form.cleaned_data['status'] status.save() return redirect('webapp:status_index') else: return render(request, 'status/update_status.html', context={ 'form': form, 'status': status })
def get (self, request, pk, *args, **kwargs): status = get_object_or_404(Status, pk=pk) if request.method == 'GET': form = StatusForm(data={ 'status': status }) return render(request, 'status/status_update.html', context={'form': form, 'status': status})
def get(self, request, *args, **kwargs): list = get_object_or_404(Status, pk=kwargs.get('pk')) form = StatusForm(data={'name': list.name}) return render(request, 'status_update.html', context={ 'form': form, 'list': list })
def get(self, request, *args, **kwargs): status_pk = kwargs.get('pk') status = get_object_or_404(Status, pk=status_pk) form = StatusForm(data={ 'status': status.status, }) return render(request, 'status/update_status.html', context={ 'form': form, 'status': status })
def get(self, request, *args, **kwargs): form = StatusForm() return render(request, 'status_add.html', context={'form': form})
def post (self, request, pk, *args, **kwargs): form = StatusForm(data=request.POST) status = get_object_or_404(Status, pk=pk) return render(request, 'status/status_update.html', context={'form': form, 'status': status})
def get (self,request, *args, **kwargs): if request.method == 'GET': form = StatusForm() return render(request, 'status/status_create.html', context={'form': form})