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?
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']})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With