Update web/core/views.py
This commit is contained in:
parent
4ba6e5deb6
commit
8b82f5f8c5
@ -8,7 +8,6 @@ from django.views.decorators.http import require_http_methods
|
|||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
import csv
|
import csv
|
||||||
import re
|
import re
|
||||||
import random
|
|
||||||
|
|
||||||
from .models import Entry
|
from .models import Entry
|
||||||
from .forms import ImportForm, EntryForm
|
from .forms import ImportForm, EntryForm
|
||||||
@ -565,26 +564,3 @@ def stats_page(request):
|
|||||||
"book_distribution": book_distribution,
|
"book_distribution": book_distribution,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@login_required
|
|
||||||
def search_page(request):
|
|
||||||
# ... your existing search logic above ...
|
|
||||||
|
|
||||||
# --- Illustration of the Day (simple, no persistence required) ---
|
|
||||||
illustration_entry = None
|
|
||||||
qs_day = Entry.objects.exclude(illustration__isnull=True).exclude(illustration="")
|
|
||||||
if qs_day.exists():
|
|
||||||
chosen = qs_day.order_by("?").first() # simple random row
|
|
||||||
illustration_entry = {
|
|
||||||
"illustration": chosen.illustration or "",
|
|
||||||
"application": chosen.application or "",
|
|
||||||
}
|
|
||||||
|
|
||||||
return render(
|
|
||||||
request,
|
|
||||||
"search.html",
|
|
||||||
{
|
|
||||||
# ... your existing context keys ...
|
|
||||||
"illustration_of_the_day": illustration_entry, # << add this
|
|
||||||
},
|
|
||||||
)
|
|
||||||
Loading…
Reference in New Issue
Block a user