コード例 #1
0
ファイル: views.py プロジェクト: zengemvisor-gb/Kiwi
    def get_context_data(self, **kwargs):
        form = SearchCaseForm(self.request.GET)
        if self.request.GET.get('product'):
            form.populate(product_id=self.request.GET['product'])
        else:
            form.populate()

        return {
            'form': form,
        }
コード例 #2
0
ファイル: views.py プロジェクト: asankov/Kiwi
    def get_context_data(self, **kwargs):
        form = SearchCaseForm(self.request.GET)
        if self.request.GET.get("product"):
            form.populate(product_id=self.request.GET["product"])
        else:
            form.populate()

        return {
            "form": form,
        }
コード例 #3
0
def search(request):
    """
        Shows the search form which uses JSON RPC to fetch the resuts
    """
    form = SearchCaseForm(request.GET)
    if request.GET.get('product'):
        form.populate(product_id=request.GET['product'])
    else:
        form.populate()

    context_data = {
        'form': form,
    }
    return render(request, 'testcases/search.html', context_data)
コード例 #4
0
def build_cases_search_form(request, populate=None, plan=None):
    """Build search form preparing for quering TestCases"""
    # Initial the form and template
    action = request.POST.get('a')
    if action in TESTCASE_OPERATION_ACTIONS:
        search_form = SearchCaseForm(request.POST)
        request.session['items_per_page'] = \
            request.POST.get('items_per_page', settings.DEFAULT_PAGE_SIZE)
    else:
        d_status = get_case_status(request.POST.get('template_type'))
        d_status_ids = d_status.values_list('pk', flat=True)
        items_per_page = request.session.get('items_per_page',
                                             settings.DEFAULT_PAGE_SIZE)
        search_form = SearchCaseForm(initial={
            'case_status': d_status_ids,
            'items_per_page': items_per_page
        })

    if populate:
        if request.POST.get('product'):
            search_form.populate(product_id=request.POST['product'])
        elif plan and plan.product_id:
            search_form.populate(product_id=plan.product_id)
        else:
            search_form.populate()

    return search_form