diff --git a/patchwork/templates/patchwork/partials/series-list.html b/patchwork/templates/patchwork/partials/series-list.html new file mode 100644 index 000000000..c31739568 --- /dev/null +++ b/patchwork/templates/patchwork/partials/series-list.html @@ -0,0 +1,154 @@ +{% load person %} +{% load listurl %} +{% load patch %} +{% load project %} +{% load static %} + +{% include "patchwork/partials/pagination.html" %} + +{% if order.editable %} + + + + +
+
+ {% csrf_token %} + + + + + +
+
+{% endif %} + +{% if page.paginator.long_page and user.is_authenticated %} +
+ + + +
+{% endif %} + + + +
+ {% csrf_token %} + + + + + +{% if user.is_authenticated %} + +{% endif %} + +{% if user.is_authenticated and user.profile.show_ids %} + +{% endif %} + + + + + + + + + + + + +{% for series in page.object_list %} + +{% if user.is_authenticated %} + +{% endif %} +{% if user.is_authenticated and user.profile.show_ids %} + +{% endif %} + + + + + +{% empty %} + + + +{% endfor %} + +
+ + + ID + + Version + + Series + +{% if order.name == "date" %} + + + + + Date + +{% else %} +{% if not order.editable %} + Date +{% else %} + Date +{% endif %} +{% endif %} + +{% if order.name == "submitter" %} + + + + + Submitter + +{% else %} +{% if not order.editable %} + + Submitter + +{% else %} + Submitter +{% endif %} +{% endif %} +
+ + + + + {{ series.version|default:"-"}} + + + {{ series.name|default:"[no subject]"|truncatechars:100 }} + + {{ series.date|date:"Y-m-d" }}{{ series.submitter|personify:project }}
No series to display
+ +{% if page.paginator.count %} +{% include "patchwork/partials/pagination.html" %} + +{% endif %} +
diff --git a/patchwork/templates/patchwork/series.html b/patchwork/templates/patchwork/series.html new file mode 100644 index 000000000..5669458e0 --- /dev/null +++ b/patchwork/templates/patchwork/series.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% load person %} +{% load static %} + +{% block title %}{{project.name}}{% endblock %} +{% block series_active %}active{% endblock %} + +{% block body %} + +{% include "patchwork/partials/series-list.html" %} + +{% endblock %} diff --git a/patchwork/urls.py b/patchwork/urls.py index ecd3668de..c3a2cf875 100644 --- a/patchwork/urls.py +++ b/patchwork/urls.py @@ -36,6 +36,11 @@ patch_views.patch_list, name='patch-list', ), + path( + 'project//series-list/', + patch_views.series_list, + name='series-list', + ), path( 'project//bundles/', bundle_views.bundle_list, diff --git a/patchwork/views/__init__.py b/patchwork/views/__init__.py index cdad279d4..aed26dca6 100644 --- a/patchwork/views/__init__.py +++ b/patchwork/views/__init__.py @@ -12,6 +12,7 @@ from patchwork.models import Bundle from patchwork.models import BundlePatch from patchwork.models import Patch +from patchwork.models import Series from patchwork.models import Project from patchwork.models import Check from patchwork.paginator import Paginator @@ -179,6 +180,7 @@ def generic_list( filter_settings=None, patches=None, editable_order=False, + series_view=False ): if not filter_settings: filter_settings = [] @@ -273,48 +275,65 @@ def generic_list( else: context['filters'].set_status(filterclass, setting) - if patches is None: - patches = Patch.objects.filter(project=project) + if series_view: + series_list = Series.objects.filter(project=project) + series_list = series_list.only( + 'submitter', + 'project', + 'version', + 'name', + 'date', + 'id', + ) + series_list = series_list.select_related('project') - # annotate with tag counts - patches = patches.with_tag_counts(project) + if not editable_order: + series_list = order.apply(series_list) - patches = context['filters'].apply(patches) - if not editable_order: - patches = order.apply(patches) + paginator = Paginator(request, series_list) + else: + if patches is None: + patches = Patch.objects.filter(project=project) - # we don't need the content, diff or headers for a list; they're text - # fields that can potentially contain a lot of data - patches = patches.defer('content', 'diff', 'headers') + # annotate with tag counts + patches = patches.with_tag_counts(project) - # but we will need to follow the state and submitter relations for - # rendering the list template - patches = patches.select_related( - 'state', 'submitter', 'delegate', 'series' - ) + patches = context['filters'].apply(patches) + if not editable_order: + patches = order.apply(patches) - patches = patches.only( - 'state', - 'submitter', - 'delegate', - 'project', - 'series__name', - 'name', - 'date', - 'msgid', - ) + # we don't need the content, diff or headers for a list; they're text + # fields that can potentially contain a lot of data + patches = patches.defer('content', 'diff', 'headers') - # we also need checks and series - patches = patches.prefetch_related( - Prefetch( - 'check_set', - queryset=Check.objects.only( - 'context', 'user_id', 'patch_id', 'state', 'date' - ), + # but we will need to follow the state and submitter relations for + # rendering the list template + patches = patches.select_related( + 'state', 'submitter', 'delegate', 'series' + ) + + patches = patches.only( + 'state', + 'submitter', + 'delegate', + 'project', + 'series__name', + 'name', + 'date', + 'msgid', + ) + + # we also need checks and series + patches = patches.prefetch_related( + Prefetch( + 'check_set', + queryset=Check.objects.only( + 'context', 'user_id', 'patch_id', 'state', 'date' + ), + ) ) - ) - paginator = Paginator(request, patches) + paginator = Paginator(request, patches) context.update( { diff --git a/patchwork/views/patch.py b/patchwork/views/patch.py index e2c595fba..f600fd309 100644 --- a/patchwork/views/patch.py +++ b/patchwork/views/patch.py @@ -38,6 +38,22 @@ def patch_list(request, project_id): return render(request, 'patchwork/list.html', context) +def series_list(request, project_id): + project = get_object_or_404(Project, linkname=project_id) + context = generic_list( + request, + project, + 'series-list', + view_args={'project_id': project.linkname}, + series_view=True, + ) + + if request.user.is_authenticated: + context['bundles'] = request.user.bundles.all() + + return render(request, 'patchwork/series.html', context) + + def patch_detail(request, project_id, msgid): project = get_object_or_404(Project, linkname=project_id) db_msgid = Patch.decode_msgid(msgid) diff --git a/templates/base.html b/templates/base.html index b7e2d4f28..8440f43ca 100644 --- a/templates/base.html +++ b/templates/base.html @@ -54,6 +54,12 @@ Patches +
  • + + + Series + +