I'll admit that I read through the thread in about a minute, so forgive me
if I'm completely off, but isn't this something that can be solved through
aggregation[1]?

And you don't want votes, but rather *contexts*, because all of these
matter to you, whereas votes can be 0 (default). Speaking of which, why not
define "default = 0" for votes rather than using NOT NULL?


[1] http://django.me/aggregation



Cheers,
AT


On Tue, Dec 6, 2011 at 6:11 PM, wgis <alpha.sh...@gmail.com> wrote:

> I get
> (Carrots, Flavor,2.0)
>
> I want to list all the contexts in the "Carrot template", withou
> having to search and merge the ones missing.
> So if the result was
>
> (Carrots, Flavour, 2.0)
> (Carrots, Smell, 0.0)
> (Carrots, Usability, 0.0)
> (Carrots, Size, 0.0)
> or
> (Carrots, Flavour, 2.0)
> (Carrots, Smell, null)
> (Carrots, Usability, null)
> (Carrots, Size, null)
>
> I could just list them, without further querying.
>
> On 6 Dez, 12:46, Reinout van Rees <rein...@vanrees.org> wrote:
> > On 06-12-11 06:43, wgis wrote:
> >
> > > But then I would have something like
> > > (Carrots, Flavor,2.0)
> > > as the result
> >
> > > instead of the desired
> >
> > > (Carrots, Flavour, 2.0)
> > > (Carrots, Smell, 0.0)
> > > (Carrots, Usability, 0.0)
> > > (Carrots, Size, 0.0)
> >
> > That's the same, right? At least,
> >
> > Vote.objects.filter(thing=carrot).values_list('thing', 'context', 'vote)
> >
> > should return a list of those lists.
> >
> > What do you get with a plain Vote.objects.filter(thing=carrot) ?
> >
> > Reinout
> >
> > --
> > Reinout van Rees                    http://reinout.vanrees.org/
> > rein...@vanrees.org            http://www.nelen-schuurmans.nl/
> > "If you're not sure what to do, make something. -- Paul Graham"
>
> --
> 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.
>
>

-- 
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.

Reply via email to