Skip to content

Commit 5cfa0dd

Browse files
committed
views: add series-detail view
Signed-off-by: andrepapoti <[email protected]>
1 parent 5878433 commit 5cfa0dd

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{% extends "base.html" %}
2+
3+
{% load humanize %}
4+
{% load syntax %}
5+
{% load person %}
6+
{% load patch %}
7+
{% load static %}
8+
{% load utils %}
9+
10+
{% block title %}{{series.name}}{% endblock %}
11+
12+
{% block body %}
13+
14+
<div>
15+
<h1>{{ series.name }}</h1>
16+
</div>
17+
18+
<table class="patch-meta">
19+
<tr>
20+
<th>Cover Letter</th>
21+
<td>{{ series.cover_letter.content|default:"No cover letter available" }}</td>
22+
</tr>
23+
<tr>
24+
<th>Date</th>
25+
<td>{{ series.date }}</td>
26+
</tr>
27+
<tr>
28+
<th>Submitter</th>
29+
<td>{{ series.submitter }}</td>
30+
</tr>
31+
<tr>
32+
<th>Total</th>
33+
<td>{{ series.patches }}</td>
34+
</tr>
35+
</table>
36+
<br>
37+
<h2>Patches:</h2>
38+
<br>
39+
{% include "patchwork/partials/patch-list.html" %}
40+
41+
{% endblock %}

patchwork/urls.py

+5
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@
115115
name='comment-redirect',
116116
),
117117
# series views
118+
path(
119+
'project/<project_id>/series/<int:series_id>/',
120+
series_views.series_detail,
121+
name='series-detail',
122+
),
118123
path(
119124
'series/<int:series_id>/mbox/',
120125
series_views.series_mbox,

patchwork/views/series.py

+23
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
from django.shortcuts import render
1010

1111
from patchwork.models import Series
12+
from patchwork.models import Patch
1213
from patchwork.models import Project
14+
from patchwork.views import generic_list
1315
from patchwork.views.utils import series_to_mbox
1416
from patchwork.paginator import Paginator
1517

@@ -26,6 +28,27 @@ def series_mbox(request, series_id):
2628
return response
2729

2830

31+
def series_detail(request, project_id, series_id):
32+
series = get_object_or_404(Series, id=series_id)
33+
34+
patches = Patch.objects.filter(series=series)
35+
36+
context = generic_list(
37+
request,
38+
series.project,
39+
'series-detail',
40+
view_args={
41+
'project_id': project_id,
42+
'series_id': series_id,
43+
},
44+
patches=patches,
45+
)
46+
47+
context.update({'series': series})
48+
49+
return render(request, 'patchwork/series-detail.html', context)
50+
51+
2952
def series_list(request, project_id):
3053
project = get_object_or_404(Project, linkname=project_id)
3154
context = {}

0 commit comments

Comments
 (0)