Update web/core/views.py
This commit is contained in:
parent
0c239c231b
commit
b421abe69d
@ -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.views.decorators.http import require_http_methods
|
||||||
from django.utils.text import Truncator
|
from django.utils.text import Truncator
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.views.decorators.cache import never_cache
|
||||||
|
|
||||||
from .forms import ImportForm, EntryForm
|
from .forms import ImportForm, EntryForm
|
||||||
from .models import Entry
|
from .models import Entry
|
||||||
@ -250,13 +251,14 @@ def nav_prev(request):
|
|||||||
return render(request, "entry_view.html", ctx)
|
return render(request, "entry_view.html", ctx)
|
||||||
|
|
||||||
|
|
||||||
|
@never_cache
|
||||||
def entry_view(request, entry_id):
|
def entry_view(request, entry_id):
|
||||||
ids = request.session.get("result_ids", [])
|
ids = request.session.get("result_ids", [])
|
||||||
entry = get_object_or_404(Entry, pk=entry_id)
|
entry = get_object_or_404(Entry, pk=entry_id)
|
||||||
|
|
||||||
ctx = entry_context(entry, ids)
|
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 {}
|
last = request.session.get("last_search") or {}
|
||||||
ctx["last_search_q"] = last.get("q", "")
|
ctx["last_search_q"] = last.get("q", "")
|
||||||
ctx["last_search_fields"] = last.get("fields", [])
|
ctx["last_search_fields"] = last.get("fields", [])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user