Metadata-Version: 2.4
Name: collective.address
Version: 1.7
Summary: Dexterity address behavior.
Home-page: https://github.com/collective/collective.address
Author: Johannes Raggam
Author-email: thetetet@gmail.com
License: GPL
Keywords: plone collective address
Classifier: Framework :: Plone
Classifier: Framework :: Plone :: 5.2
Classifier: Framework :: Plone :: 6.0
Classifier: Framework :: Plone :: 6.1
Classifier: Framework :: Plone :: 6.2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Classifier: Development Status :: 5 - Production/Stable
Requires-Python: >=2.7
Requires-Dist: setuptools
Requires-Dist: plone.api
Requires-Dist: plone.app.textfield
Requires-Dist: plone.autoform
Requires-Dist: plone.behavior
Requires-Dist: plone.indexer
Requires-Dist: plone.supermodel
Requires-Dist: Products.CMFPlone
Requires-Dist: pycountry
Requires-Dist: zope.i18nmessageid
Requires-Dist: zope.interface
Requires-Dist: zope.schema
Requires-Dist: six
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

collective.address
==================

This package provides some `Dexterity behavior`_ to be used in `Dexterity based types`_ for:

``IAddress`` behavior, some fields to describe the ``Address`` data.

.. figure:: https://raw.githubusercontent.com/collective/collective.address/refs/heads/master/docs/images/iaddress_behavior.png
    :align: center
    :height: 79px
    :width: 732px
    :alt: The IAddress Behavior

    The ``IAddress`` Behavior.

.. figure:: https://raw.githubusercontent.com/collective/collective.address/refs/heads/master/docs/images/address_schema.png
    :align: center
    :height: 341px
    :width: 737px
    :alt: Using the IAddress Behavior into a custom content type.

    Using the ``IAddress`` Behavior into a custom content type.

----

``IContact`` behavior, some fields to describe the ``Contact`` data.

.. figure:: https://raw.githubusercontent.com/collective/collective.address/refs/heads/master/docs/images/icontact_behavior.png
    :align: center
    :height: 75px
    :width: 788px
    :alt: The IContact Behavior

    The ``IContact`` Behavior.

.. figure:: https://raw.githubusercontent.com/collective/collective.address/refs/heads/master/docs/images/contact_schema.png
    :align: center
    :height: 196px
    :width: 800px
    :alt: Using the IContact Behavior into a custom content type

    Using the ``IContact`` Behavior into a custom content type.

----

``IPerson`` behavior, some fields to describe the ``Person`` data.

.. figure:: https://raw.githubusercontent.com/collective/collective.address/refs/heads/master/docs/images/iperson_behavior.png
    :align: center
    :height: 75px
    :width: 745px
    :alt: The IPerson Behavior

    The ``IPerson`` Behavior.

.. figure:: https://raw.githubusercontent.com/collective/collective.address/refs/heads/master/docs/images/person_schema.png
    :align: center
    :height: 81px
    :width: 778px
    :alt: Using the IPerson Behavior into a custom content type

    Using the ``IPerson`` Behavior into a custom content type.

----

``ISocial`` behavior, some fields to describe the ``Person`` data.

.. figure:: https://raw.githubusercontent.com/collective/collective.address/refs/heads/master/docs/images/isocial_behavior.png
    :align: center
    :height: 81px
    :width: 778px
    :alt: The ISocial Behavior

    The ``ISocial`` Behavior.

.. figure:: https://raw.githubusercontent.com/collective/collective.address/refs/heads/master/docs/images/social_media_schema.png
    :align: center
    :height: 492px
    :width: 467px
    :alt: Using the ISocial Behavior into a custom content type.

    Using the ``ISocial`` Behavior into a custom content type.

----


Examples
========

This add-on can be seen in action at the following add-ons:

- https://github.com/collective/collective.venue
- https://github.com/g24at/g24.elements
- https://github.com/b4oshany/rohberg.bluechurch
- https://github.com/RedTurtle/iosanita.contenttypes
- https://github.com/RedTurtle/design.plone.ctgeneric
- https://github.com/RedTurtle/design.plone.contenttypes


Translations
============

This product has been translated into

- Deutsch
- Francese
- Italian
- Spanish


Installation
============

If you installed Plone with `Cookieplone`_, you can install ``collective.address`` add-on 
from a source control system such as GitHub.

Add a line with ``collective.address`` in the ``backend/requirements.txt`` file.

::

    collective.address

Next add the add-on to ``zcml_package_includes`` in the file ``backend/instance.yaml`` so
that its configuration will load.

::

    default_context:
        zcml_package_includes: project_title, collective.address

Finally, add the package's source to the ``mx.ini`` file.

::

    [collective.address]
    url = https://github.com/collective/collective.address.git
    pushurl = git@github.com:collective/collective.address.git
    branch = master

To actually download and install the new add-on, run the following command.

::

    make backend-build

Now restart the backend.

----

If you installed Plone with `buildout`_, you can install ``collective.address`` add-on
by adding it to your ``buildout`` eggs list like so:

::

    [buildout]

    ...

    eggs =
        collective.address


and then running ``bin/buildout``

Now restart the instance.


Tips
====

The following are some tips on how to use this add-on.

How to provide a default value for the country field
----------------------------------------------------

If you want to provide a default value for the ``IAddress`` country field, you can
provide an ``ComputedWidgetAttribute`` adapter like so:

::

    from zope.component import provideAdapter
    from z3c.form.widget import ComputedWidgetAttribute
    from collective.address.behaviors import IAddress

    DEFAULT_COUNTRY = "040"  # Austria
    provideAdapter(ComputedWidgetAttribute(
        lambda data: DEFAULT_COUNTRY,
        field=IAddress['country']), name='default')

The country code must be the numeric ISO 3166-1 code as a string. You can find
the list of codes here: https://en.wikipedia.org/wiki/ISO_3166-1_numeric

If you want to play with the country codes in a Python shell, you can use the
``pycountry`` package like so:

::

    >>> import pycountry
    >>> austria = pycountry.countries.get(numeric='040')
    >>> austria
    Country(alpha_2='AT', alpha_3='AUT', flag='🇦🇹', name='Austria', numeric='040', official_name='Republic of Austria')
    >>> spain = pycountry.countries.get(alpha_2='ES')
    >>> spain
    Country(alpha_2='ES', alpha_3='ESP', flag='🇪🇸', name='Spain', numeric='724', official_name='Kingdom of Spain')

You can install ``pycountry`` via pip:

::

    pip3 install pycountry

For more information, see the `pycountry`_ documentation.


Compatibility
=============

- Tested with Python 3.12 and Plone 6.1.2.


License
=======

The project is licensed under the GPLv2.


Contribute
==========

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


Author
=======

- `Johannes Raggam <mailto:raggam-nl@adm.at>`_

.. _Dexterity behavior: https://6.docs.plone.org/backend/behaviors.html
.. _Dexterity based types: https://6.docs.plone.org/backend/content-types/index.html
.. _Cookieplone: https://github.com/plone/cookieplone
.. _pycountry: https://pypi.org/project/pycountry/
.. _buildout: https://6.docs.plone.org/admin-guide/add-ons.html#buildout


Changelog
=========

1.7 (2026-03-29)
----------------

- Added more improvements about the add-on documentation.
  [macagua]

- Added spanish translation.
  [macagua]

- Added more improvements about i18n support.
  [macagua]


1.6 (2019-06-07)
----------------

- Python 3 compatibilty
  [petschki]

- Added french translation.
  [bsuttor]

- Added italian translation.
  [arsenico13]

- Added update.sh script for i18ndude taken directly from plonecli.
  [arsenico13]

- Updated DE .po file with the update.sh script.
  [arsenico13]


1.5 (2017-01-13)
----------------

- Translate country name via pycountry translation catalog.
  [thet]

- Code cleanup.
  [thet]


1.4 (2016-10-06)
----------------

- Add behavior shortnames.
  [thet]

- Remove ``for`` attribute in behavior registrations, as this is unsupported.
  [thet]

- Change all URL fields to use ``zope.schema.URI``.
  [thet]

- Added behavior for social media urls.
  [agitator]


1.3.2 (2015-09-24)
------------------

- Encode SearchableText indexer result in utf-8.
  [thet]


1.3.1 (2015-08-27)
------------------

- Fix error on creating the title for Person types with non-ascii characters in
  names.
  [thet]


1.3 (2015-07-21)
----------------

- Let IAddressable not derive from schema.Model to have a pure marker
  Interface.
  [thet]

- Make sure, all SearchableText parts are seperated by a space.
  [thet]


1.2 (2015-07-15)
----------------

- Require the last_name attribute of IPerson behavior.
  [thet]

- For the IPerson behavior, compute the title from first and last name and add
  title (not required, hidden) and description to the IPerson behavior.
  [thet]


1.1 (2015-03-04)
----------------

- Add IContact and IPerson behaviors in addition to the IAddress behavior.
  [thet]

- PEP 8.
  [thet]


1.0 (2014-04-30)
----------------

- initial.
