|
4 | 4 | from django.contrib.auth.decorators import login_required, permission_required
|
5 | 5 | from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
|
6 | 6 | from django.contrib.auth.models import Group
|
| 7 | +from django_filters import FilterSet |
| 8 | +from django_filters.views import FilterView |
7 | 9 | from django.http import HttpResponse, HttpResponseRedirect
|
8 | 10 | from django.shortcuts import render
|
9 | 11 | from django.urls import reverse
|
10 | 12 | from django.utils.html import format_html
|
11 |
| -from django_tables2 import SingleTableView |
| 13 | +from django_tables2 import SingleTableView, SingleTableMixin |
12 | 14 |
|
13 | 15 | from ponder.forms import CategorizationForm, CategorizerForm
|
14 | 16 | from .models import Categorization, User, BugFix, Categorizer, CommitDetail, Commit, ProblemCategory, ProblemCause, \
|
15 | 17 | ProblemFix, ProblemSymptom
|
16 | 18 | from .tables import Categorizations_FilterTable, BugFixes_FilterTable, BugFixesTable, CommitDetailsTable, CommitsTable
|
17 | 19 |
|
| 20 | +class SHAFilter(FilterSet): |
| 21 | + class Meta: |
| 22 | + model = BugFix |
| 23 | + fields = {"sha" } |
18 | 24 |
|
19 | 25 | def index(request):
|
20 | 26 | user = request.user.username
|
@@ -108,7 +114,7 @@ def categorizations_by_bugFixID(request):
|
108 | 114 | pb_fix = '-'
|
109 | 115 | except:
|
110 | 116 | pb_fix = '—'
|
111 |
| - |
| 117 | + |
112 | 118 | context = {'table': table, 'id_value': id_value, 'sha': sha, 'is_func_fix': is_func_fix, 'project': project, \
|
113 | 119 | 'category_comment': activateLinks(obj.category_comment), 'cause_comment': activateLinks(obj.cause_comment), 'symptom_comment': activateLinks(obj.symptom_comment), 'fix_comment': activateLinks(obj.fix_comment), \
|
114 | 120 | 'pb_category': pb_category, 'pb_cause': pb_cause, 'pb_symptom': pb_symptom, 'pb_fix': pb_fix, 'should_discuss': should_discuss}
|
@@ -406,8 +412,9 @@ def get_context_data(self, **kwargs):
|
406 | 412 | context['sha'] = Commit.objects.values('sha').filter(id=self.kwargs['pk'])[0]['sha']
|
407 | 413 | return context
|
408 | 414 |
|
409 |
| -class BugFixesTableView(LoginRequiredMixin, PermissionRequiredMixin, SingleTableView): |
| 415 | +class BugFixesTableView(LoginRequiredMixin, PermissionRequiredMixin, SingleTableMixin, FilterView): |
410 | 416 | permission_required = 'ponder.view_bugfix'
|
411 | 417 | model = BugFix
|
412 | 418 | table_class = BugFixesTable
|
| 419 | + filterset_class = SHAFilter |
413 | 420 | template_name = 'ponder/bugfixes_table.html'
|
0 commit comments