From c7fb7dfa8fd17d13dfdffd312d672a03da44e988 Mon Sep 17 00:00:00 2001 From: Andre Papoti Date: Tue, 24 Dec 2024 17:19:05 -0300 Subject: [PATCH] views: add series navigation buttons for patch-detail view --- patchwork/templates/patchwork/submission.html | 14 ++++++++++++++ patchwork/views/patch.py | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html index cd74491c..88ad58aa 100644 --- a/patchwork/templates/patchwork/submission.html +++ b/patchwork/templates/patchwork/submission.html @@ -20,6 +20,20 @@

{{ submission.name }}

+
+ + next + +
+ +
+ + previous + +
+ diff --git a/patchwork/views/patch.py b/patchwork/views/patch.py index 198b26ca..e1f86ef2 100644 --- a/patchwork/views/patch.py +++ b/patchwork/views/patch.py @@ -133,6 +133,20 @@ def patch_detail(request, project_id, msgid): if errors: context['errors'] = errors + try: + context['previous_submission'] = Patch.objects.get( + series=patch.series, number=patch.number - 1 + ) + except Patch.DoesNotExist: + context['previous_submission'] = None + + try: + context['next_submission'] = Patch.objects.get( + series=patch.series, number=patch.number + 1 + ) + except Patch.DoesNotExist: + context['next_submission'] = None + return render(request, 'patchwork/submission.html', context)
Message ID