Background and strategic fit
Add the repeating plugin to your ckan.plugins configuration settings and use ckanext-scheming or a custom form plugin to use the provided validators to store repeating values in metadata fields.
This for example is required for the author or maintainer of a resource entry where we might have more than one person responsible for.
Installations and Requirements
To install ckanext-repeating on a production site:
Activate your CKAN virtual environment, for example:
ENV /usr/lib/ckan/default/bin/activate
Install the ckanext-repeating Python package into your virtual environment:
pip install ckanext-repeating // or pip install -e git+https://github.com/open-data/ckanext-repeating#egg=ckanext-repeating
Add the relevant plugins to the
ckan.pluginssetting in your CKAN config file.Add
ckanext.repeating:presets.jsonto your scheming. presets configuration settings:scheming.presets = ckanext.scheming:presets.json ckanext.repeating:presets.jsonRestart CKAN. For example, if you've deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
User interaction and design
A repeating field in a scheming schema will look something like:
{
"field_name": "authors",
"preset": "repeating_text",
"label": "Author",
"form_blanks": 3
}
This new extra field "authors" will appear as multiple fields in the dataset form, with three blank values below existing values. by the [form snippet](ckanext/repeating/templates/scheming/form_snippets/repeating_text.html).
When displayed, each value for the text entered will appear separately by the [display snippet](ckanext/repeating/templates/scheming/display_snippets/repeating_text.html), eg.:
When the dataset is accessed from the API each value will appear and are updated as items in a list, eg.:
{
"...": "...",
"authors": [
"Person One",
"Person Two"
],
"...": "..."
}
Questions and Answers
Below is a list of Q&A from user sides:
| Question | Answers |
|---|---|

