Monday, April 29, 2013

Re: Little help needed writing models for star-ratings app



On Monday, April 29, 2013 10:31:34 PM UTC+5:30, Shawn Milochik wrote:
It looks like you're not looking for a "little help." You're looking for someone to do the work for you.

You'll get the best help if you try something, get stuck, and explain what you tried and what the error is.

Here is the documentation for using the ORM. This is not a snarky response -- I really hope you do read it and learn how to use Django's ORM, which is what you need to answer your own questions.


Read that, try some stuff, then ask specific questions when you have problems. You'll get a lot of great help if you do that.

I am not sure but.. my concern is more about "relationships"

How should I be defining Rating model for

counting number of specific ratings it got
user who rated it.. 

probably, to log the user data

user = models.ForeignKey(User) would work

But counting number of specific ratings it got is the issue!!

Say there is a Book X. Its ratings are by default 0, 0
Now, as the users add ratings, its get added up to the default and its fine.. 

but how to know who added what ratings? and how many times he changed etc..

would a ManyToMany field with User and Rating would work?

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment