Update web/core/views.py

This commit is contained in:
Joshua Laymon 2025-08-23 16:19:18 +00:00
parent 0c239c231b
commit b421abe69d

View File

@ -11,6 +11,7 @@ from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.http import require_http_methods
from django.utils.text import Truncator
from django.urls import reverse
from django.views.decorators.cache import never_cache
from .forms import ImportForm, EntryForm
from .models import Entry
@ -250,13 +251,14 @@ def nav_prev(request):
return render(request, "entry_view.html", ctx)
@never_cache
def entry_view(request, entry_id):
ids = request.session.get("result_ids", [])
entry = get_object_or_404(Entry, pk=entry_id)
ctx = entry_context(entry, ids)
# [ADD] pass last search into the template
# Pass last search to the template for the highlighter
last = request.session.get("last_search") or {}
ctx["last_search_q"] = last.get("q", "")
ctx["last_search_fields"] = last.get("fields", [])