def availability(request, pool_id): pool = get_object_or_404(Pool, pk=pool_id) form = ClusterSearchForm(request.GET or None) searcher = SubjectSearcher(Lane, pool.lanes) available_lanes = searcher.search(**form.cleaned_data) if form.is_valid() else [] return render( request, 'pools/availability.html', { 'pool': pool, 'form': form, 'available_lanes': available_lanes } )
def index(request): form = ClusterSearchForm(request.GET or None) if form.is_valid(): results = cluster_searcher.search(**form.cleaned_data) lane_search_query_string = urllib.urlencode({ 'start': form.cleaned_data['start'], 'end': form.cleaned_data['end'], 'required_size': form.cleaned_data['required_size']}) else: results = None lane_search_query_string = '' return render( request, 'pools/index.html', { 'form': form, 'available_pools': results, 'lane_search_query_string': lane_search_query_string, } )