swap next and prev

This commit is contained in:
2023-01-30 09:24:00 +00:00
parent 0a0282cdfa
commit c5a67ad37c
2 changed files with 7 additions and 7 deletions

View File

@@ -139,7 +139,7 @@ class PostDetailView(DetailView):
"author": author,
"author_image": author_image,
"next": self.post_next(),
"previous": self.post_previous(),
"prev": self.post_prev(),
"related_posts": related_posts[:4],
}
@@ -158,9 +158,9 @@ class PostDetailView(DetailView):
return template_name
def post_next(self):
def post_prev(self):
"""
Helper function for getting next post
Helper function for getting previous post
"""
posts = Post.objects.date_sorted_list(self.public_only).filter(
post_type=self.object.post_type
@@ -171,9 +171,9 @@ class PostDetailView(DetailView):
return qs.first().slug
def post_previous(self):
def post_next(self):
"""
Helper function for getting previous post
Helper function for getting next post
"""
posts = (
Post.objects.date_sorted_list(self.public_only)

View File

@@ -12,7 +12,7 @@
{% block content %}
<!-- Main Content -->
<main class="container mx-auto w-full flex-1 my-8 sm:flex flex-col sm:px-4">
<a href="{% url 'posts:post' previous %}" class="hidden z-20 fixed left-0 top-1/2 -mt-8 p-2 xl:flex items-center text-gray-400 dark:text-gray-300 rounded-md"
<a href="{% url 'posts:post' prev %}" class="hidden z-20 fixed left-0 top-1/2 -mt-8 p-2 xl:flex items-center text-gray-400 dark:text-gray-300 rounded-md"
x-data="prevArticleButton"
@mouseleave="closeShowPrevArticleButton"
@mouseover="openShowPrevArticleButton"
@@ -104,7 +104,7 @@
<hr class="-mx-4 border-gray-200 dark:border-gray-800 dark:border my-4">
<div class="-m-4 flex divide-x divide-gray-200 dark:divide-gray-800 dark:divide-x-2 text-sm sm:text-base">
<a href="{% url 'posts:post' previous %}" class="w-1/2 p-4 flex items-center gap-2">
<a href="{% url 'posts:post' prev %}" class="w-1/2 p-4 flex items-center gap-2">
<i class="fa-solid fa-chevron-left text-gray-600 dark:text-gray-400"></i>
<span class="text-gray-700 dark:text-gray-300 font-medium">{% block prev_text %}Vorheriger Artikel{% endblock %}</span>
</a>