I did something like this recently. I also created my own manager. This is my code.

class LessonManager(models.Manager): def for_user(self, user): res = super(LessonManager, self).get_query_set().filter(published=True).select_related(depth=2) for rec in res: rec.userlessoninfo = rec.info_for_user(user) return res

In my Lesson Model class:

def info_for_user(self, user): try: uli = self.userlessoninfo_set.get(user=user) except UserLessonInfo.DoesNotExist: uli = None return uli

It's pretty slick. I suppose I don't need the select_related in there. However it works great.
Email me if you have any questions or need any help. It looks like my code is missing the white space sorry if it's hard to read, but it's only a few lines. Doing it this way you have full access to the UserLessonInfo object. If you would just want to make one call you could do something similar but instead write your own SQL STatement in the manager with the fields you want. I could show you how to do that too.

Chris Swenor (July 07, 2011 at 5:07 p.m.)

This poor old blog needs an overhaul. The comments do support markdown, although I've neglected to mention it.

Here's the code samples with whitespace:

class LessonManager(models.Manager):
    def for_user(self, user):
        res = super(LessonManager, self).get_query_set().filter(published=True).select_related(depth=2)
        for rec in res:
            rec.userlessoninfo = rec.info_for_user(user)
        return res

and

def info_for_user(self, user):
        try:
            uli = self.userlessoninfo_set.get(user=user)
        except UserLessonInfo.DoesNotExist:
            uli = None
        return uli
— Sam (July 07, 2011 at 7:11 p.m.)

Hello there, I love your blog www.pocketuniverse.ca . Is there something I can do to receive updates like a subscription or some thing? I am sorry I'm not acquainted with RSS?

promotion web (January 25, 2012 at 4:52 a.m.)