Hi Daniel, i don't want to presentate the data. i want to produce graphs with this data. so it's not a presentation problem. i know that i can use python to get the data in correct order and style, but it's a huge amount of data and python would be very slow for that. so it's better when the database does the work.
On 13 Sep., 19:32, Daniel Roseman <dan...@roseman.org.uk> wrote: > On 2009/9/13, tom <toab...@googlemail.com> wrote: > > > > > > > I have a model to save measurement data. Every datarow has a > > identifier(CharField) and a value(FloatField) and a entry(ForeignKey). > > For example: > > > Entry Identifier value > > 1 s1 100 > > 1 d1 180 > > 1 q5 300 > > 2 z88 10 > > ... > > ... > > > With my query, i want to have as result: > > > entry value value value > > 1 100 180 300 > > > So, my query gets every value for a entry in a row. > > This is a presentation issue, rather than a query one. You just want > to get all the values, and group your output by entry id. > > So in your view you do: > values = Value.objects.all().order_by('entry_id') > > and in your template: > {% for value in values %} > {% ifchanged value.entry_id %} > <tr><td>{% value.entry_id %}</td> > {% endifchanged %} > <td>{% value.value %}</td> > {% endfor %} > > or something along those lines. > -- > DR. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---