Metadata-Version: 2.4
Name: collective.z3cform.jsonwidget
Version: 2.0.0
Summary: Custom widget to manage complex json data stored into a text field
Home-page: https://github.com/collective/collective.z3cform.jsonwidget
Author: Andrea Cecchi
Author-email: andrea.cecchi85@gmail.com
License: GPL version 2
Project-URL: PyPI, https://pypi.python.org/pypi/collective.z3cform.jsonwidget
Project-URL: Source, https://github.com/collective/collective.z3cform.jsonwidget
Project-URL: Tracker, https://github.com/collective/collective.z3cform.jsonwidget/issues
Keywords: Python Plone
Classifier: Environment :: Web Environment
Classifier: Framework :: Plone
Classifier: Framework :: Plone :: Addon
Classifier: Framework :: Plone :: 5.2
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Requires-Python: >=3.7
License-File: LICENSE.GPL
License-File: LICENSE.rst
Requires-Dist: setuptools
Requires-Dist: z3c.jbot
Requires-Dist: plone.api>=1.8.4
Requires-Dist: plone.restapi
Requires-Dist: plone.app.dexterity
Provides-Extra: test
Requires-Dist: plone.app.testing; extra == "test"
Requires-Dist: plone.testing>=5.0.0; extra == "test"
Requires-Dist: plone.app.contenttypes; extra == "test"
Requires-Dist: plone.app.robotframework[debug]; extra == "test"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

.. This README is meant for consumption by humans and pypi. Pypi can render rst files so please do not use Sphinx features.
   If you want to learn more about writing documentation, please check out: http://docs.plone.org/about/documentation_styleguide.html
   This text does not appear on pypi or github. It is a comment.

=============================
collective.z3cform.jsonwidget
=============================

z3c.form widget to manage a json field.

Features
--------

- Customizable schema

Usage
-----

You need to set the widget to needed fields into your form instance::

    from collective.z3cform.jsonwidget.browser.widget import JSONFieldWidget
    from zope.interface import Interface
    from zope import schema


    class IMyJsonSchema(Interface):
        first = schema.TextLine(
            title='first field',
            required=True,
        )
        second = schema.List(
            title="second field",
            required=False,
            value_type=schema.TextLine(),
        )

    class IFormSchema(Interface):
        my_json_field = schema.SourceText(
            title="The field with some stored json values"
        )

    class MyForm(Form):

        ...
        schema = IFormSchema
        fields = field.Fields(IFormSchema)
        fields["my_json_field"].widgetFactory = JSONFieldWidget

        def updateWidgets(self):
            """
            """
            super(MyForm, self).updateWidgets()
            self.widgets["my_json_field"].schema = IMyJsonSchema


With this configuration, we are setting **JSONFieldWidget** widget to **my_json_field** field and
setting the fields schema defined in **IMyJsonSchema** interface.

In the field are stored a list of json objects where each object has a set of fields defined in the schema.

For example for the given configuration, we are going to store into the field something like::

    [
        {
            "first": "a string",
            "second": [1,2,3,4]
        },
        {
            "first": "another string",
            "second": ["a", "b", "c"]
        },
    ]


Translations
------------

This product has been translated into

- Italian


Installation
------------

Install collective.z3cform.jsonwidget by adding it to your buildout::

    [buildout]

    ...

    eggs =
        collective.z3cform.jsonwidget


and then running ``bin/buildout``


Contribute
----------

- Issue Tracker: https://github.com/collective/collective.z3cform.jsonwidget/issues
- Source Code: https://github.com/collective/collective.z3cform.jsonwidget


Credits
-------

Developed with the support of `Regione Emilia Romagna`__;

Regione Emilia Romagna supports the `PloneGov initiative`__.

__ http://www.regione.emilia-romagna.it/
__ http://www.plonegov.it/

Authors
-------

This product was developed by RedTurtle Technology team.

.. image:: http://www.redturtle.net/redturtle_banner.png
   :alt: RedTurtle Technology Site
   :target: http://www.redturtle.net/


Contributors
============

- Andrea Cecchi, andrea.cecchi85@gmail.com


Changelog
=========


2.0.0 (2026-03-26)
------------------

- Plone 6 compatibility. Use 1.x tags for Plone < 6. [cekk]
  [cekk]


1.1.2 (2023-04-26)
------------------

- Fix release.
  [cekk]


1.1.1 (2023-04-21)
------------------

- Handle integer fields.
  [cekk]

1.1.0 (2022-07-18)
------------------

- Force vocabularies batch size to 1000 to get all of possible values.
  [cekk]


1.0.0 (2021-12-20)
------------------

- Improve widget usability.
  [cekk]


0.2.4 (2021-12-13)
------------------

- Fix defaulValue in select fields. Now we can also reset the values.
  [cekk]

0.2.3 (2021-08-18)
------------------

- Fix homepage breadcrumb.
  [cekk]


0.2.2 (2021-08-17)
------------------

- Fix breadcrumbs and pagination in ReferenceField.
  [cekk]


0.2.1 (2021-05-18)
------------------

- Add alt text on buttons
- Add locales for a11y hints
  [nzambello]


0.2.0 (2021-05-17)
------------------

- Add link and path to referenced items
  [nzambello]
- Fix TextLine field.
  [cekk]

0.1.0 (2021-02-09)
------------------

- Initial release.
  [cekk]
