From dc851e83d526d37eda6568818ab8b2363a510bd5 Mon Sep 17 00:00:00 2001 From: Patrick Canterino Date: Sun, 30 Jan 2022 15:03:05 +0100 Subject: [PATCH] And now we can list the notes in a certain month --- notes/templates/archive_month.html | 10 +++++++++- notes/views.py | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/notes/templates/archive_month.html b/notes/templates/archive_month.html index ced8896..1bcf028 100644 --- a/notes/templates/archive_month.html +++ b/notes/templates/archive_month.html @@ -5,5 +5,13 @@ {% block content %}

Archive {{ month }} / {{ year }}

- +{% if notes %} + +{% else %} +

No notes

+{% endif %} {% endblock %} \ No newline at end of file diff --git a/notes/views.py b/notes/views.py index ef6414f..d2c8bb0 100644 --- a/notes/views.py +++ b/notes/views.py @@ -42,4 +42,5 @@ def archive_year(request, archive_year): return render(request, 'archive_year.html', {'year': archive_year, 'months': notes_months}) def archive_month(request, archive_year, archive_month): - return render(request, 'archive_month.html', {'year': archive_year, 'month': archive_month}) \ No newline at end of file + notes = Note.objects.filter(status=1, created_at__year=archive_year, created_at__month=archive_month) + return render(request, 'archive_month.html', {'year': archive_year, 'month': archive_month, 'notes': notes}) \ No newline at end of file -- 2.34.1