the point is, i've information that are not already in the object i want to display.
example:
i want to display the model called "Question" which has a set of "answers" given by "users"
now, how can i display for each question:
- the number of answer
- the number of correct answer
- the set of users who correctly answered.
?
can i do this with the detailview? beacuse i didn't find it out. or do i've to create a class to match the data i want to display and render this in a template?
On Sunday, October 28, 2012 10:03:21 PM UTC+1, Sergiy Khohlov wrote:
Have you tried detailview ?
Also it is possible to add some values to the temple in view
2012/10/28 Stefano Tranquillini <stefano.tr...@gmail.com >:
> Hi all.
> just a question about how to proceed.
> when i've to display data direct from the model (the db) one in a page is
> simple.
> what if i want to display aggregate data or some data that needs logic?
> i've to do it in the view and add the object to the contex, or it's better
> to do a custom tag filter?
>
> what if i've a list of objects and for each object i've to compute an
> aggregate data?
> for example i've a list of cars and for each car i want to know how many
> models exists. if i do in the view, how can i attach the aggregate data
> (which is a query) to each car? is it better to do with a custom tag filter?
>
> ciao.
>
> --
> Stefano
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en .
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Jm4FDBT42dsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment