Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plone update Collection Filter

Can I update a filter from a Plone Collection (plone.app.collection)?

I have a Collection with thhose filters:

portal_type = Project
review_state = published

With an BrowserView (Form) I want to extends this filter a follow:

portal_type = Project  
review_state = published
+  
subject = ['test', 'foo']

How can I achieve this?

like image 249
user966660 Avatar asked Dec 09 '25 19:12

user966660


1 Answers

It's very simple thanks to recent changes done on plone.app.collection (be sure to use plone.app.collection 1.1.2 or newer).

Having the collection loaded in your code as collection (or probably context if you are running your view on the collection itself) if you call...:

results = collection.results()

...results will contains all contents found by collection itself, so with you review_state and portal_type filter applied.

But you can use the custom_query param as follow:

results = collection.results(custom_query={'Subject': ['test', 'foo']})
like image 122
keul Avatar answered Dec 11 '25 11:12

keul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!