On 29 Sty, 03:16, marsanyi wrote:
> The joy of annotate(). In Django 1.1 and above:
>
> result = Student.objects.annotate(latest = models.Max('grades__date'))
>
> gives you the recordset, sans test_name. Any advances on this?
>
I would suggest:
students = Student.objects.annotate(latest_grad
The joy of annotate(). In Django 1.1 and above:
result = Student.objects.annotate(latest = models.Max('grades__date'))
gives you the recordset, sans test_name. Any advances on this?
On Jan 28, 1:57 pm, Michael Shepanski wrote:
> Is it possible to code this scenario using the Django ORM?
>
> I
In SQL, this would be (and I'm winging this right now so I might be
slightly off)
SELECT name, address, `date`, test_name, grade
FROM Student as stu
LEFT JOIN Grade ON stu.id = Grade.student_id
WHERE `date` >=
(SELECT max(`date`) FROM Grade WHERE student_id = stu.id)
ORDER BY name
Unless you
Is it possible to code this scenario using the Django ORM?
I have two tables:
STUDENT: id, name, address
GRADES: id, student_id, date, test_name, grade
Each Student will have several entries in the Grades table. I am
wondering if it is possible using Django's ORM to select all students
along
4 matches
Mail list logo