In writing an application for my school's yearbook committee, I've hit a bit of a dead end with modeling a specific relation. Currently I have a photo class
class Photo(models.Model):
photo = models.ImageField(upload_to="user_photos/")
name = models.CharField(blank=True, max_length=50)
rating = models.IntegerField(default=1000)
wins = models.IntegerField(default=0)
matches = models.IntegerField(default=0)
and a user class
class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
group = models.CharField(max_length=50)
both of which are working swimmingly. What I'd like to do is break it up so that a Photo will have global rating derived from votes of the entire userbase as well as a rating based only on the users votes on that photo. Unfortunately, I'm at a loss on how to structure this. My first thought was a ManyToMany field, but I was also thinking that something like breaking rating into its own model like this:
class Rating(models.Model)
photo = models.ManyToOne(Photo)
rating = models.IntegerField(default=1500)
could work.
Could a Django (or really, anyone who's slightly competent, because I know I'm not) guru point me in the proper direction on approaching this simple conundrum?