コード例 #1
0
def search(request, tid):
    test = get_object_or_404(Test, id=tid)
    templates = Finding_Template.objects.all()
    templates = TemplateFindingFilter(request.GET, queryset=templates)
    paged_templates = get_page_items(request, templates.qs, 25)

    title_words = get_words_for_field(Finding_Template, 'title')

    add_breadcrumb(parent=test,
                   title="Add From Template",
                   top_level=False,
                   request=request)
    return render(
        request, 'dojo/templates.html', {
            'templates': paged_templates,
            'filtered': templates,
            'title_words': title_words,
            'tid': tid,
            'add_from_template': True,
        })
コード例 #2
0
ファイル: views.py プロジェクト: mattvaldes/django-DefectDojo
def search(request, tid):
    test = get_object_or_404(Test, id=tid)
    templates = Finding_Template.objects.all()
    templates = TemplateFindingFilter(request.GET, queryset=templates)
    paged_templates = get_page_items(request, templates, 25)
    title_words = [
        word for finding in templates for word in finding.title.split()
        if len(word) > 2
    ]

    title_words = sorted(set(title_words))
    add_breadcrumb(parent=test,
                   title="Add From Template",
                   top_level=False,
                   request=request)
    return render(
        request, 'dojo/templates.html', {
            'templates': paged_templates,
            'filtered': templates,
            'title_words': title_words,
            'tid': tid,
            'add_from_template': True,
        })