Hi everyone,

I'm a relatively new user to Python and Django, and I'm impressed so far
- very nice!

I have a question regarding the app I'm currently developing - a photo
album. Here is a rough copy of my models.py (trimmed for brevity):


class Photo(models.Model):
    title = models.CharField(maxlength=50)
    rating = models.PositiveIntegerField(default=0)

class Album(models.Model):
    title = models.CharField(maxlength=50)
    pub_date = models.DateField()

class AlbumPhoto(models.Model):
    album = models.ForeignKey(Album, related_name='items')
    photo = models.ForeignKey(Photo)
    position = models.PositiveIntegerField()


I've used an intermediate class for the M-N relationship since I wanted
to store "position" to allow the user to order photos in a custom order.

However, I also need to be able to retrieve photos from an album in
other orders, such as by the title or rating of the photo. I'm not sure
how to do this though, since order_by('photo__title') didn't seem to
work for me.

It's quite possible (probable?) I'm going about this the wrong way but
am looking for any tips or suggestions about how this should be
implemented the "right" way in Django.

I couldn't any reference to anything like this in the Django site or
this group, but I may have been searching for the wrong terms.

I've already done an event calendar using Django and I must say it was
pretty painless once I got up to speed, and the various blogs around in
the Django community helped a lot with this. Thanks guys!

Cheers for any help,

Nick


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

Reply via email to