我正在構建基於Plone 4.1的網站,並且正在嘗試查找按多個排序條件對集合進行排序的最佳方法,或者至少要自定義要執行的集合portlet所以對於網站的字體頁面。我相信portlet使用收集排序設置,除非您選擇隨機。下面是代碼在portlet標準結果的部分:如何自定義plone 4集合以便按多個字段進行排序
def _standard_results(self):
results = []
collection = self.collection()
if collection is not None:
limit = self.data.limit
if limit and limit > 0:
# pass on batching hints to the catalog
results = collection.queryCatalog(batch=True, b_size=limit)
results = results._sequence
else:
results = collection.queryCatalog()
if limit and limit > 0:
results = results[:limit]
return results
例如,我想可以,如果存在以由到期日期排序,如果沒有則使用創建日期的例子。或按標籤和創建日期排序。任何關於最佳方法的反饋將不勝感激。