Hi, I'm leaning more towards NullBooleanField at the moment.
There's a number of reasons we're going for binary voting (like/dislike), versus say a star rating. Firstly, rating systems like that are ambiguous - a 2-star rating from me may not be the same as a 2-star rating from somebody else. I believe YouTube used to have star ratings, and then Google changed them to likes/dislike. General consensus seems to be that binary-voting systems are better. http://onpon4.blogspot.com.au/2011/12/5-star-ratings-vs-likesdislikes-why.html http://davidcel.is/blog/2012/02/01/why-i-hate-five-star-ratings/ Cheers, Victor On Thursday, 18 July 2013 06:31:15 UTC+10, arnonym wrote: > > On Tue, 16 Jul 2013 17:29:47 -0700 (PDT) Victor Hooi > <[email protected] <javascript:>> wrote: > > We have a list of users, who are going to like/dislike various > > widgets. > > > > My question is regarding how to store the like/dislikes. > > > > Essentially, there can be three states between a user and a widget - > > like, dislike, and unrated, so it's not just a straight Boolean. > > > > I'm thinking of just doing a M2M between user and widgets models, and > > then storing an extra field on that M2M. > > > > I can either store a Boolean, for whether the item is liked/unliked - > > and then an unrated item simply won't be exist in the table. > > > > Or I can store a integer (with a choice tupled defined), with say > > 0=unrated, 1=like, 2 = unlike, and all possible combinations are > > listed. > > > > We'll be doing queries to compare users, and see if their > > likes/dislikes intersect. > > > > Are there any pros/cons of the two approaches for this given query, > > or is there perhaps a more efficient way of storing this data? > > I would probably do this with an explicit many to many relationship. > My first thought would be to use a boolean (true for like, false for > unlike, not a row in the table for unrated). On second thought I would > replace your integer-enum idea by using the integer for a real rating > for example from -5 to 5. While at first you might just map like/unlike > to 5/-5, for the future you could do rows of stars or rows of > thumbs-up/-downs. > > Have fun, > > Arnold > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.

