Commit 229580d6 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_discussion: customize how to get discussion post

1. ignore size, some user has size=XX in there rss, which make catalog search versionning table
2. add limit
3. sort by modification date
parent b1b6fa81
""" """
Get list of latest Posts which belong to a forum (i.e. websection + predicate) Get list of latest Posts which belong to a forum (i.e. websection + predicate)
""" """
limit = 100
kw.pop("size", None)
# first get list of all container Threads (details should be set on predicate) # first get list of all container Threads (details should be set on predicate)
parent_uid_list = [x.getUid() for x in context.getDocumentValueList()] parent_uid_list = [x.getUid() for x in context.getDocumentValueList(limit=limit, sort_on=(('modification_date', 'DESC'),))]
# get sorted list of all "contained" in them Posts # get sorted list of all "contained" in them Posts
kw['sort_on'] = (('modification_date', 'DESC'),) kw['sort_on'] = (('modification_date', 'DESC'),)
...@@ -13,4 +15,6 @@ if len(parent_uid_list)==0: ...@@ -13,4 +15,6 @@ if len(parent_uid_list)==0:
# no parent discussion threads therefore no posts # no parent discussion threads therefore no posts
return [] return []
kw['limit'] = limit
return context.portal_catalog(**kw) return context.portal_catalog(**kw)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment