Commit 643248f0 authored by Boxiang Sun's avatar Boxiang Sun Committed by Eteri

erp5_post: Sort the post list when fetching the content from database. And...

erp5_post: Sort the post list when fetching the content from database. And only get the post which state is "published".
parent 02202139
...@@ -14,8 +14,7 @@ else: ...@@ -14,8 +14,7 @@ else:
raise NotImplementedError(follow_up) raise NotImplementedError(follow_up)
# get the all HTML Posts which related to this follow up object # get the all HTML Posts which related to this follow up object
post_list = portal.portal_catalog(portal_type="HTML Post", strict_follow_up_uid=follow_up_object.getUid()) # with id keyword, this function will return a sequence data type which contains one element. post_list = portal.portal_catalog(portal_type="HTML Post", strict_follow_up_uid=follow_up_object.getUid(), sort_on=(('modification_date', 'ascending'),), validation_state="published") # with id keyword, this function will return a sequence data type which contains one element.
post_list = sorted(post_list, key=lambda x:x.getStartDate(), reverse=False)
preferred_date_order = portal.portal_preferences.getPreferredDateOrder() preferred_date_order = portal.portal_preferences.getPreferredDateOrder()
......
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