Answer the question
In order to leave comments, you need to log in
How to implement this request in django?
Select * from polls_answer where votes = 1 and is_active = 1
How to implement this request in a view?
By means of django. Are there built-in functions.
And how to directly write sql queries in django?
Answer the question
In order to leave comments, you need to log in
clean queries should be written as an argument to the raw method:
but it's better not to do so.
for p in Polls_answers.objects.raw('Select * from polls_answer where votes = 1 and is_active = 1'):
... print(p)
Polls_answers.objects.filter(votes=1,is_active = 1)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question