On Sun, 2009-01-18 at 02:48 -0800, Piotr Husiatyński wrote: > Hello, > I'm writing forum and I have a problem with *show new posts* feature. > Here's the code of my application: > > http://github.com/husio/arch-pl/tree/09234f6d780c76b45b5e1a6576d80080507873d4/forum > > I have two tables for *new* posts > - AllVisited for marking all posts as visited > - VisitedThread for remembering each post that user has seen > > Line ~70 of view.py file is the incomplete question > > dt = search_date_limit > unreaded = Thread.objects.filter( > Q(latest_post_date__gt=dt), > Q(visitedthread__isnull=True) | > Q(visitedthread__isnull=False, > visitedthread__date__lt= ? ) # > thread__latest_post_date ? > ).distinct()[offset:offset + number] > > The only thing I don't know how to do is how to check each > Thread.latest_post_date value during sql select and compare it with > VisitedThread.date value. How to write it?
Wait a few days until ticket #7210 is resolved and you'll be able to use references to other fields as rhs values in filters. The work for that is nearly complete, so it's pretty close to being committed. I'm fairly sure that will help you there. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---