14 lines
334 B
Python
14 lines
334 B
Python
|
|
from django.shortcuts import render
|
||
|
|
|
||
|
|
from content.models import Question
|
||
|
|
|
||
|
|
|
||
|
|
def search_question(request):
|
||
|
|
term = request.GET.get('term')
|
||
|
|
items = []
|
||
|
|
if term:
|
||
|
|
items = Question.get_by_tearchterm(term)
|
||
|
|
else:
|
||
|
|
items = Question.objects.all()[:10]
|
||
|
|
return render(request, 'questions.html', {'items': items})
|