From 4d7ec56cfdf43293e67c524c4f060441a9f32e71 Mon Sep 17 00:00:00 2001 From: Or Israel Date: Thu, 21 Apr 2022 19:41:06 +0300 Subject: [PATCH] Adding costants for categories.html and read_more.html --- tips/constants.py | 2 ++ tips/templates/tips/read_more.html | 2 +- tips/views.py | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tips/constants.py b/tips/constants.py index 21dc598a..5150a6a2 100644 --- a/tips/constants.py +++ b/tips/constants.py @@ -1,3 +1,5 @@ TIPS_PAGE_ROUTE = 'tips/index.html' ADD_TIP_PAGE_ROUTE = 'tips/add_tip.html' EDIT_TIP_PAGE_ROUTE = 'tips/edit_tip.html' +READ_MORE_PAGE_ROUTE = 'tips/read_more.html' +CATEGORIES_PAGE_ROUT = 'tips/categories.html' diff --git a/tips/templates/tips/read_more.html b/tips/templates/tips/read_more.html index 73184686..5a347e70 100644 --- a/tips/templates/tips/read_more.html +++ b/tips/templates/tips/read_more.html @@ -36,4 +36,4 @@

{{ tip.author }}

-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/tips/views.py b/tips/views.py index 9160342d..4b20c760 100644 --- a/tips/views.py +++ b/tips/views.py @@ -1,7 +1,7 @@ from django.shortcuts import render, redirect, get_object_or_404 from .models import Tip from .forms import TipForm -from .constants import TIPS_PAGE_ROUTE, ADD_TIP_PAGE_ROUTE, EDIT_TIP_PAGE_ROUTE +from .constants import TIPS_PAGE_ROUTE, ADD_TIP_PAGE_ROUTE, EDIT_TIP_PAGE_ROUTE, READ_MORE_PAGE_ROUTE, CATEGORIES_PAGE_ROUT def board(request): @@ -22,12 +22,12 @@ def add_tip(request): def categories_filter(request, cats): category_filtered_tips = Tip.objects.filter(category=cats) - return render(request, 'tips/categories.html', {'cats': cats, 'category_filtered_tips': category_filtered_tips}) + return render(request, CATEGORIES_PAGE_ROUT, {'cats': cats, 'category_filtered_tips': category_filtered_tips}) def read_more_view(request, tip_id): tip = get_object_or_404(Tip, pk=tip_id) - return render(request, 'tips/read_more.html', {'tip': tip}) + return render(request, READ_MORE_PAGE_ROUTE, {'tip': tip}) def edit_tip(request, tip_id):