On 28 nov, 11:07, coan <[EMAIL PROTECTED]> wrote:
> I have book editions in my database. Users can rate editions. If they
> want, they can also add them to their book collection.
> Here is a simplified overview of the models:
>
> class Edition(models.Model):
>  title   = models.models.CharField(max_length=255)
>  binding        = models.models.CharField(max_length=30)
>
> class Bookcollection(models.Model):
>  user    = models.ForeignKey(User)
>  edition = models.ForeignKey(Edition)
>
> class Rating(models.Model):
>  user    = models.ForeignKey(User)
>  edition = models.ForeignKey(Edition)
>  rating = models.PositiveIntegerField()
>
> I can fetch all the books in a users bookcollection with editions =
> user.edition_set.all()
> What do I do if I want to order a users bookcollection by the rating
> he or she gave it?

What's the point of having two distinct models for Bookcollection and
Rating ??? Looks like mostly redundant to me.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to