def all_flow_toggles(request): if request.method == 'POST': form = FlowToggleForm(request.POST) if form.is_valid(): return form.save() else: errors = _form_errors(form) raise kbapi.BadRequestError(errors) return models.FlowToggle.objects.all()
def all_flow_toggles(request): if request.method == "POST": form = FlowToggleForm(request.POST) if form.is_valid(): return form.save() else: errors = _form_errors(form) raise kbapi.BadRequestError(errors) return models.FlowToggle.objects.all()
def get_flow_toggle(request, flow_toggle_id): toggle = get_object_or_404(models.FlowToggle, id=flow_toggle_id) if request.method == 'DELETE': toggle.delete() return RESULT_OK elif request.method == 'POST': form = FlowToggleForm(request.POST, instance=toggle) if form.is_valid(): toggle = form.save() else: errors = _form_errors(form) raise kbapi.BadRequestError(errors) return protolib.ToProto(toggle, full=True)
def get_flow_toggle(request, flow_toggle_id): toggle = get_object_or_404(models.FlowToggle, id=flow_toggle_id) if request.method == "DELETE": toggle.delete() return RESULT_OK elif request.method == "POST": form = FlowToggleForm(request.POST, instance=toggle) if form.is_valid(): toggle = form.save() else: errors = _form_errors(form) raise kbapi.BadRequestError(errors) return protolib.ToProto(toggle, full=True)