python - Django QuerySet filter + order_by + limit -


Then I have a Django app that processes the test results, and I find the average score for a certain estimate I am trying to I would think this would work:

  e = test.Objects. Total () total = E. Median_exam = Exam.objects .filter (evaluation = evaluation.id) .order_by ('score') [average: 1] median_score = median_exam.score  
/ Pre>

but it always gives an empty list. I can get results with:

  e = test.Objects. Total () total = E. Coat (average) = intestine (round (total / 2)) exam = exam .objects.filter (evaluation = evaluation.ede). Medi_score = median_exam [average] .score  

I do not want to fully inquire about the exam. I thought about writing a raw MySQL query, which looks like this:

  Assessment_exam SELECT score WHERE evaluation_ID = 5 ORDER score score 690.1  

But if possible, I want to be inside the Django ORM. Mostly, it just bothers me that I can not use the sequence with a filter and range, any thoughts?

Your slice syntax is incorrect after the colon does not count the elements to get the value, but Index of the end of the slice. Using 'average' on your own without colon, as you do in your second example, will work.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -