> >         subs_sel = list(BBSubs.select(BBSubs.q.user_id==1))
> >         for sub in subs_sel:
> >             sub.topic = BBTopic.get(sub.topic_id)
> >             sub.post  = BBPost.get(sub.topic.last_post_id)
> >             sub.forum = BBForum.get(sub.topic.forum_id)
> 
>    Why do you assign values explicitly Why not to use ForeignKey?
> 
> >         subs = sorted(subs_sel, lambda x: x.topic.last_post_id)
> 
>    I don't see any problem with the code. Can you write a short standalone
> script that I can run to see the problem?
> 
> Oleg.


Thanks for the tip on ForeignKey, I've been doing a lot of the above without 
using it and I knew I was missing something. The problem was a missing key= in 
the sorted function as I typed from memory and forgot it. 

subs = sorted(subs_sel, key=lambda x: x.topic.last_post_id)




------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to