I'm developing Django app.
I want to render variable "q_word" to the template from this views.py
class DbList(ListView):
model = TestEu
paginate_by = 10
def get_queryset(self):
q_word = self.request.GET.get('query')
if q_word:
sql = 'select * from test_eu'
sql += " where eng_discription ~ '.*" + q_word +".*'"
object_list = TestEu.objects.raw(sql)
return object_list
Since "get_queryset" function apply "self" as first argument
def get_queryset(self):
I don't know how to apply below code to render.
return render(request, 'detail.html', {'q_word': q_word})