django query and get the maximum of repeated -



django query and get the maximum of repeated -

to larn django did little app allow user vote restaurant of choice. table hold voted option, , trying query table base of operations on date, , 1 attribute repeated. know restaurant won.

and query base of operations on date(that way can vote 1 different each day), , restaurant_id repeated.

image of table

link image

https://www.dropbox.com/s/pszt46bdqstahky/table.png?dl=0

this code.

getting queryset of dates. there how repetead restaurant_id?

the_max = choice.objects.filter(date_vote=date) the_max = list(the_max) d = {x: the_max(x) x in the_max} chosen_restaurant = max(d, key=d.get)

i trying set repetition dictionary , max there. django have filter aggregation? little explanation how utilize it?

thanks guys.

django

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -