No. There is a good chance that the person who uploaded the memo
(db.memo_store.created_by) is not the same as the person viewing the memo
(db.viewed_memos.created_by).
My solution, for people who are interested in something similar:

def unread_memos():
    """
    Will return a list of all unread memos
    """
    # We want to count the # of memos which we haven't looked at
    read_memos=db(db.viewed_memos.created_by==auth.user_id).select(
        db.viewed_memos.memo, groupby=db.viewed_memos.memo)
    mul=[] # Our read memos list
    if len(read_memos) > 0:
        for row in read_memos:
            mul.append(row.memo)
        unread=db(~db.memo_store.id.belongs(mul)).select(db.memo_store.ALL,

orderby=~db.memo_store.created_on)
    else:
        unread=db(db.memo_store).select(db.memo_store.ALL,
orderby=~db.memo_store.created_on)

    return dict(unread_rows=unread)


On 6 July 2011 08:14, pbreit <pbreitenb...@gmail.com> wrote:

> I don't totally understand but would this do it?
>
> db(db.memo_store.created_by==auth.user.id)(db.viewed_memos.memo==
> db.memo_store.id).select()
>

Reply via email to