def StatusCheckSearchViewFBV(request, name=None): if request.method == 'GET': form = HostSearchForm(request.GET) if form.is_valid(): name = form.cleaned_data['name'] return redirect('checks_search', name=name) else: return redirect('checks') else: return redirect('checks')
def ServiceSearchViewFBV(request, name=None): if request.method == 'GET': form = HostSearchForm(request.GET) if form.is_valid(): name = form.cleaned_data['name'] try: service = Service.objects.get(name=name) return redirect('service', pk=service.pk) except Service.DoesNotExist: # return redirect('instances') return redirect('service_search', name=name) return redirect('service_search', name=name) else: return redirect('services') else: return redirect("services")
def StatusCheckSearchViewFBV(request, name=None): if request.method == 'GET': form = HostSearchForm(request.GET) if form.is_valid(): name = form.cleaned_data['name'] try: check = StatusCheck.objects.get(name=name) return redirect('check', pk=check.pk) except StatusCheck.DoesNotExist: # return redirect('instances') return redirect('checks_search', name=name) else: return redirect('checks') else: return redirect('checks')