Skip to main content

Dexterity address behavior.

Project description

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.

The IAddress Behavior

The IAddress Behavior.

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.

The IContact Behavior

The IContact Behavior.

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.

The IPerson Behavior

The IPerson Behavior.

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.

The ISocial Behavior

The ISocial Behavior.

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:

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

Author

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective_address-1.7.tar.gz (139.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

collective_address-1.7-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file collective_address-1.7.tar.gz.

File metadata

  • Download URL: collective_address-1.7.tar.gz
  • Upload date:
  • Size: 139.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for collective_address-1.7.tar.gz
Algorithm Hash digest
SHA256 077638aed9535a87fddca90770e21cf1424b56e3154ba7e5e78035f320378574
MD5 8686dee213d281c423f4b47451563dce
BLAKE2b-256 1494c9a4ab2d7acfb097ca43db1fc87879011463ac77e60a30864eef7351a770

See more details on using hashes here.

File details

Details for the file collective_address-1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for collective_address-1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 22425e680992c8edee73a70bba775d777984e33a55de0834360a842d1a667720
MD5 ffabd5e2ad85169710d01ddef7952fc9
BLAKE2b-256 1ce17ca4272e0644d6a5acb01b3c65111a9d8bbf6d0b81ee30efeef55b853bfa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page