From ede319f68918c14d81bf7ac42ec4f00ed895e225 Mon Sep 17 00:00:00 2001 From: andrepapoti Date: Tue, 23 Apr 2024 12:45:15 -0300 Subject: [PATCH] views: add series navigation buttons for patch-detail view Signed-off-by: andrepapoti --- patchwork/templates/patchwork/submission.html | 16 ++++++++++++++++ patchwork/views/patch.py | 14 ++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html index 85e7be4b..90ee22b2 100644 --- a/patchwork/templates/patchwork/submission.html +++ b/patchwork/templates/patchwork/submission.html @@ -20,6 +20,22 @@

{{ submission.name }}

+ + + + diff --git a/patchwork/views/patch.py b/patchwork/views/patch.py index 54cf992c..4d0ec4eb 100644 --- a/patchwork/views/patch.py +++ b/patchwork/views/patch.py @@ -148,6 +148,20 @@ def patch_detail(request, project_id, msgid): context['related_same_project'] = related_same_project context['related_different_project'] = related_different_project + 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