This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
plone.formwidget.querystring/README.rst

78 lines
2.2 KiB
ReStructuredText
Raw Normal View History

Introduction
============
2011-10-26 17:51:53 +02:00
2012-02-07 14:08:16 +01:00
A z3c.form-based widget for composing a Query string/search.
2011-10-26 17:51:53 +02:00
2012-02-07 14:08:16 +01:00
This widget is used by the contentlisting tile and the dexterity-based version
of plone.app.collection (>2.0), to make selections, and 'build' your query. It
stores a list of dictionaries containing the query you've build. This query is
2011-10-26 17:51:53 +02:00
being parsed by using plone.app.collection and that used
plone.app.contentlisting to display the results in the tile.
2011-10-28 06:47:09 +02:00
Installation
============
If you install plone.formwidget.querystring, you probably want to use it in
an add-on product for Plone. Therefore you can add it to the setup.py of your
package::
install_requires=[
'plone.formwidget.querystring',
2012-02-07 14:08:16 +01:00
...
2011-10-28 06:47:09 +02:00
],
2012-02-07 14:08:16 +01:00
You probably want to also use it to the list of dependencies in your generic
2011-10-28 06:47:09 +02:00
setup profile (profiles/default/metadata.xml)::
<metadata>
<version>1</version>
<dependencies>
<dependency>profile-plone.formwidget.querystring:default</dependency>
</dependencies>
</metadata>
Dexterity Widget
================
To assign the plone.formwidget.querystring widget to a field in your custom
content type, you can use a plone.autoform directive in the interfaces
definition (interfaces.py)::
from plone.formwidget.querystring.widget import QueryStringFieldWidget
class IMyDexteritySchema(form.Schema):
form.widget(query=QueryStringFieldWidget)
query = schema.List(
title=_(u'label_query', default=u'Search terms'),
description=_(u"""Define the search terms for the items you want to
list by choosing what to match on.
The list of results will be dynamically updated"""),
value_type=schema.Dict(value_type=schema.Field(),
key_type=schema.TextLine()),
required=False
)
.. note::
2012-02-07 14:08:16 +01:00
See:: See
2012-03-09 10:44:05 +01:00
https://github.com/plone/plone.app.collection/blob/master/plone/app/collection/interfaces.py#L16
2012-02-07 14:08:16 +01:00
and
2012-03-09 10:44:05 +01:00
https://github.com/plone/plone.app.contentlistingtile/blob/master/plone/app/contentlistingtile/tile.py#L18
2011-10-28 06:47:09 +02:00
for further examples of how to use plone.formwidget.querystring.
Credits
=======
* Kim Chee Leong
* Ralph Jacobs
* Jonas Baumann
* Hanno Schlichting
* Timo Stollenwerk