Files
Tablequizwiki/content/views/public.py

15 lines
397 B
Python
Raw Normal View History

from django.shortcuts import render
from content.models import Question
def search_question(request):
term = request.GET.get('term')
items = []
2024-07-13 10:19:49 +02:00
published = Question.objects.filter(is_published=True)
if term:
2024-07-13 10:19:49 +02:00
items = Question.get_by_tearchterm(term, published)
else:
2024-07-13 10:19:49 +02:00
items = published.all()[:10]
return render(request, 'questions.html', {'items': items})