Watch
1
0
Fork
You've already forked ckanext-switzerland-ng
0
mirror of https://github.com/opendata-swiss/ckanext-switzerland-ng.git synced 2026-08-17 12:43:14 +00:00
  • Python 55%
  • HTML 37.4%
  • JavaScript 6.2%
  • CSS 0.8%
  • Shell 0.4%
  • Other 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-30 14:52:02 +02:00
.github/workflows tests: Fix Solr volume paths 2025-07-30 19:06:09 +02:00
bin tests: Update requirements 2026-02-03 18:30:40 +01:00
ckanext docs: Update function docblock 2026-07-30 14:45:47 +02:00
solr feat: Update Solr config to match the one in use 2025-08-04 14:31:55 +02:00
.coveragerc tests: Exclude tests/ folder from coverage checks 2025-07-30 17:23:48 +02:00
.gitignore update translation pot-file and ignore mo-files 2018-01-15 11:58:49 +01:00
babel.cfg add missing jinja extensions to babel.cfg 2015-11-03 19:14:37 +01:00
CONTRIBUTING.md use yaml-file for format-mapping 2017-12-06 11:43:17 +01:00
dev-requirements.txt style: Update and run black and isort 2026-01-28 17:50:44 +01:00
LICENSE Initial commit 2015-07-31 11:05:22 +02:00
MANIFEST.in feat: Include requirements files in manifest 2025-11-24 16:57:40 +01:00
publiccode.yml feat: add publiccode.yml 2025-12-09 16:03:23 +01:00
pyproject.toml feat: Add OgdchXloaderPlugin to project entry-points 2026-01-28 17:50:44 +01:00
README.md chore: Update urls and references to ckanext-switzerland(-ng) 2025-11-24 15:50:46 +01:00
requirements.txt chore: Reduce min version of Unidecode for xloader compatibility 2025-11-24 14:21:11 +01:00
setup.cfg Merge pull request #382 from opendata-swiss/tests/check-test-files-with-flake8 2026-01-29 16:51:48 +01:00
setup.py feat: Add pyproject.toml and move setup into it 2025-11-24 13:44:52 +01:00
test.ini tests: Enable more plugins in test.ini 2025-07-30 18:02:35 +02:00

ckanext-switzerland

CKAN extension for DCAT-AP Switzerland, templates and different plugins for opendata.swiss.

Requirements

  • CKAN 2.11+
  • ckanext-scheming
  • ckanext-fluent

Installation

To install ckanext-switzerland:

  1. Activate your CKAN virtual environment, for example:

    . /usr/lib/ckan/default/bin/activate

  2. Install the ckanext-switzerland-ng Python package into your virtual environment:

    git clone https://github.com/opendata-swiss/ckanext-switzerland-ng.git cd ckanext-switzerland-ng pip install -e .

  3. Add relevant plugins to the ckan.plugins setting in your CKAN config file (by default the config file is located at /etc/ckan/default/production.ini). This package contains several plugins. See project.entry-points."ckan.plugins" in pyproject.toml for an up-to-date list.

  4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:

    sudo service apache2 reload

Config Settings

See ckanext/switzerland/config_declaration.yaml.

Development Installation

To install ckanext-switzerland for development, activate your CKAN virtualenv and do:

git clone https://github.com/opendata-swiss/ckanext-switzerland-ng.git
cd ckanext-switzerland-ng
pip install -e .[dev]

Update Format-Mapping

To update the Format-Mapping edit the format-mapping.yaml, following the YAML-Syntax. You can check if your changes are valid by pasting the contents of the required changes into a Syntax-Checker, e.g. YAML Syntax-Checker. Submit a Pull-Request following our Contribution-Guidelines.

Update translations

To generate an updated ckanext-switzerland.pot file inside the Docker container, use the following commands:

docker-compose exec ckan bash
source /usr/lib/ckan/venv/bin/activate
cd /usr/lib/ckanext/ckanext-switzerland-ng/
python setup.py extract_messages

Copy any new strings that you want to translate from the new ckanext-switzerland.pot into the ckanext-switzerland.po file for each language, and add the translations.

After that compile the po files into mo files:

python setup.py compile_catalog

Log out of the ckan container (ctrl+D) and restart it for the new translations to be used:

docker-compose restart ckan

Add users as members to groups

For opendata.swiss we use groups in the sense of categories. Therefore we need any user to be able to add their datasets to any group. For that they need to be a member of the group.

Users with the role admin are automatically added as admin to each group.

# add a specific user who is not an admin as member to a specific group:
$ curl {ckan_url}/api/3/action/ogdch_add_users_to_groups?user_id=greta.mayer&user_id=administration

# add all users that are not admins as members to a specific group:
$ curl {ckan_url}/api/3/action/ogdch_add_users_to_groups?group_id=administration

# add a specific user who is not an admin as member to all available groups:
$ curl {ckan_url}/api/3/action/ogdch_add_users_to_groups?user_id=greta.mayer

# add all users that are not admins as members to all specific groups:
$ curl {ckan_url}/api/3/action/ogdch_add_users_to_groups