Bug fixes from previous commit

This commit is contained in:
Matthias Portzel 2022-09-10 21:54:46 -04:00
parent b19bbfe905
commit 06e49a7760
3 changed files with 4 additions and 5 deletions

View File

@ -26,14 +26,13 @@ def index(request):
pages = get_all_pages() pages = get_all_pages()
[requested_slug] = parse_qs(request.query).get("page", [""]) [requested_slug] = parse_qs(request.query).get("page", [""])
print(requested_slug)
requested_page = get_page(requested_slug) requested_page = get_page(requested_slug)
thoughts = requested_page.get_all_entries() thoughts = requested_page.get_all_entries()
rendered_text = render_to_string("thoughts/index.gmi", { rendered_text = render_to_string("thoughts/index.gmi", {
"thoughts": thoughts, "thoughts": thoughts,
"first_page": requested_page == pages[0], "first_page": requested_page.slug == pages[0].slug,
"pages": pages, "pages": pages,
"current_page_slug": requested_page.slug, "current_page_slug": requested_page.slug,
}) })

View File

@ -16,7 +16,7 @@
{% endfor %} {% endfor %}
{% if not first_page %}{% for page in pages %}{% if page.slug == current_page_slug %} {% for page in pages %}{% if page.slug == current_page_slug %}
### {{ page.formatted_name }}{% else %} ### {{ page.formatted_name }}{% else %}
=> /?page={{ page.slug }} {{ page.formatted_name }}{% endif %}{% endfor %} => /?page={{ page.slug }} {{ page.formatted_name }}{% endif %}{% endfor %}
=> /search Search{% endif %} => /search Search

View File

@ -49,7 +49,7 @@ def index(request):
"authenticated": authenticated, "authenticated": authenticated,
"pages": pages, "pages": pages,
"current_page_slug": requested_page.slug, "current_page_slug": requested_page.slug,
"first_page": requested_page == pages[0] # if you're viewing the first page "first_page": requested_page.slug == pages[0].slug # if you're viewing the first page
}) })