ckanext-hierarchy


Nameckanext-hierarchy JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/davidread/ckanext-hierarchy
SummaryCKAN Organization hierarchy - templates and configuration
upload_time2023-04-05 21:12:28
maintainer
docs_urlNone
authorDavid Read
requires_python
licenseAGPL
keywords ckan
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![Travis CI status](https://travis-ci.org/davidread/ckanext-hierarchy.svg?branch=master)](https://travis-ci.org/davidread/ckanext-hierarchy)

[![Latest version on pypi](https://img.shields.io/pypi/v/ckanext-hierarchy.svg)](https://pypi.org/project/ckanext-hierarchy/)

[![License](https://img.shields.io/pypi/l/ckanext-hierarchy.svg)](https://pypi.org/project/ckanext-hierarchy/)


# ckanext-hierarchy - Organization and group hierarchy for CKAN

Organizations and groups can be arranged into a tree hierarchy.

This new hierarchical arrangement of organizations and groups is displayed
using templates in this extension, instead of the usual list:
![Screenshot of organizations page](screenshots/orgs_page.png)

Provides a new field on the organization and group edit form to select a parent
organization:
![Screenshot of organization edit page](screenshots/org_edit.png)

When viewing an organization you see its context within the tree in the side bar. In addition you can widen search of the organization's datasets to include datasets in sub-organizations too:
![Screenshot of organization page](screenshots/org_page.png)

## Technical details

Forms (hierachy_form plugin):
* /organization/new
* /organization/edit/{id}
* /group/new
* /group/edit/{id}

Templates (hierarchy_display plugin):
* /organization - now shows the organization hierarchy instead of list
* /organization/about/{id} - now also shows the relevant part of the hierarchy
* /group - now shows the group hierarchy instead of list
* /group/about/{id} - now also shows the relevant part of the hierarchy

Snippets (used by hierarchy_display and ckanext-scheming):
* /scheming/form_snippets/org_hierarchy.html

You can use this extension with CKAN as it is, enabling both plugins. Or if you
use an extension to customise the form already with an IGroupForm, then you
will want to only use the hierarchy_display plugin, and copy bits of the
hierarchy_form and/or hierarchy_group_form into your own. If you have your own templates then you can use
the snippets (or logic functions) that this extension provides to display the
trees.

In order to make hierarchy work with ckanext-scheming you need to enable just
hierarchy_display and then use corresponding form_snippet in your org_schema or group_schema.
For example, you may add next field:
```
{
    "field_name": "not_used",
    "label": "Parent organization",
    "display_snippet": null,
    "form_snippet": "org_hierarchy.html",
    "validators": "ignore_missing"
}
```

Optionally one could also specify a full name and leave the field 'title' for
the short name or acronym (more convenient for  display).
```
{
    "field_name": "longname",
    "label": "Full Name",
    "validators": "ignore_missing unicode",
    "form_snippet": "large_text.html",
    "form_attrs": {"data-module": "slug-preview-target"},
    "form_placeholder": "My Organization full name",
    "display_snippet": null
}
```

TODO:
* make the trees prettier with JSTree

## Requirements

This extension requires CKAN v2.7 or later.

## Installation

To install ckanext-hierarchy:

1. Activate your CKAN virtual environment, for example:

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

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

       cd /usr/lib/ckan/default/src
       pip install -e "git+https://github.com/davidread/ckanext-hierarchy.git#egg=ckanext-hierarchy"
       pip install -r ckanext-hierarchy/requirements.txt

3. Add ``hierarchy_display``, ``hierarchy_form`` and/or ``hierarchy_group_form`` to the ``ckan.plugins`` setting in your CKAN
   config file (by default the config file is located at
   ``/etc/ckan/default/production.ini``). Note that hierarchy_display
should come before hierarchy_form and hierarchy_group_form

   e.g.:

       ckan.plugins = stats text_view recline_view ... hierarchy_display hierarchy_form hierarchy_group_form

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

        sudo service apache2 reload

## Config settings

None at present

## Tests

To run the tests, do::

    nosetests --nologcapture --with-pylons=test.ini

To run the tests and produce a coverage report, first make sure you have
coverage installed in your virtualenv (``pip install coverage``) then run::

    nosetests --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.hierarchy --cover-inclusive --cover-erase --cover-tests


## Releasing a new version of ckanext-hierarchy

ckanext-hierarchy should be available on PyPI as https://pypi.org/project/ckanext-hierarchy.
To publish a new version to PyPI follow these steps:

1. Update the version number in the ``setup.py`` file.
   See `PEP 440 <http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers>`_
   for how to choose version numbers.

2. Make sure you have the latest version of necessary packages:

       pip install --upgrade setuptools wheel twine

3. Create a source and binary distributions of the new version:

       python setup.py sdist bdist_wheel && twine check dist/*

   Fix any errors you get.

4. Upload the source distribution to PyPI:

       twine upload dist/*

5. Commit any outstanding changes:

       git commit -a

6. Tag the new release of the project on GitHub with the version number from
   the ``setup.py`` file. For example if the version number in ``setup.py`` is
   0.0.1 then do:

       git tag 0.0.1
       git push --tags

## Licence and copyright

This module is openly licensed with AGPLv3 - see LICENSE file.

Copyright belongs to commit authors. Commits 2013-2017 by @davidread are Crown Copyright.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/davidread/ckanext-hierarchy",
    "name": "ckanext-hierarchy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "CKAN",
    "author": "David Read",
    "author_email": "david.read@hackneyworkshop.com",
    "download_url": "https://files.pythonhosted.org/packages/ed/85/ce6ccba75807e4b2420a46b78aeb8bb68c00637f8f97b700992ac92d1b16/ckanext-hierarchy-1.2.0.tar.gz",
    "platform": null,
    "description": "\n[![Travis CI status](https://travis-ci.org/davidread/ckanext-hierarchy.svg?branch=master)](https://travis-ci.org/davidread/ckanext-hierarchy)\n\n[![Latest version on pypi](https://img.shields.io/pypi/v/ckanext-hierarchy.svg)](https://pypi.org/project/ckanext-hierarchy/)\n\n[![License](https://img.shields.io/pypi/l/ckanext-hierarchy.svg)](https://pypi.org/project/ckanext-hierarchy/)\n\n\n# ckanext-hierarchy - Organization and group hierarchy for CKAN\n\nOrganizations and groups can be arranged into a tree hierarchy.\n\nThis new hierarchical arrangement of organizations and groups is displayed\nusing templates in this extension, instead of the usual list:\n![Screenshot of organizations page](screenshots/orgs_page.png)\n\nProvides a new field on the organization and group edit form to select a parent\norganization:\n![Screenshot of organization edit page](screenshots/org_edit.png)\n\nWhen viewing an organization you see its context within the tree in the side bar. In addition you can widen search of the organization's datasets to include datasets in sub-organizations too:\n![Screenshot of organization page](screenshots/org_page.png)\n\n## Technical details\n\nForms (hierachy_form plugin):\n* /organization/new\n* /organization/edit/{id}\n* /group/new\n* /group/edit/{id}\n\nTemplates (hierarchy_display plugin):\n* /organization - now shows the organization hierarchy instead of list\n* /organization/about/{id} - now also shows the relevant part of the hierarchy\n* /group - now shows the group hierarchy instead of list\n* /group/about/{id} - now also shows the relevant part of the hierarchy\n\nSnippets (used by hierarchy_display and ckanext-scheming):\n* /scheming/form_snippets/org_hierarchy.html\n\nYou can use this extension with CKAN as it is, enabling both plugins. Or if you\nuse an extension to customise the form already with an IGroupForm, then you\nwill want to only use the hierarchy_display plugin, and copy bits of the\nhierarchy_form and/or hierarchy_group_form into your own. If you have your own templates then you can use\nthe snippets (or logic functions) that this extension provides to display the\ntrees.\n\nIn order to make hierarchy work with ckanext-scheming you need to enable just\nhierarchy_display and then use corresponding form_snippet in your org_schema or group_schema.\nFor example, you may add next field:\n```\n{\n    \"field_name\": \"not_used\",\n    \"label\": \"Parent organization\",\n    \"display_snippet\": null,\n    \"form_snippet\": \"org_hierarchy.html\",\n    \"validators\": \"ignore_missing\"\n}\n```\n\nOptionally one could also specify a full name and leave the field 'title' for\nthe short name or acronym (more convenient for  display).\n```\n{\n    \"field_name\": \"longname\",\n    \"label\": \"Full Name\",\n    \"validators\": \"ignore_missing unicode\",\n    \"form_snippet\": \"large_text.html\",\n    \"form_attrs\": {\"data-module\": \"slug-preview-target\"},\n    \"form_placeholder\": \"My Organization full name\",\n    \"display_snippet\": null\n}\n```\n\nTODO:\n* make the trees prettier with JSTree\n\n## Requirements\n\nThis extension requires CKAN v2.7 or later.\n\n## Installation\n\nTo install ckanext-hierarchy:\n\n1. Activate your CKAN virtual environment, for example:\n\n       . /usr/lib/ckan/default/bin/activate\n\n2. Install the ckanext-hierarchy Python package into your virtual environment:\n\n       cd /usr/lib/ckan/default/src\n       pip install -e \"git+https://github.com/davidread/ckanext-hierarchy.git#egg=ckanext-hierarchy\"\n       pip install -r ckanext-hierarchy/requirements.txt\n\n3. Add ``hierarchy_display``, ``hierarchy_form`` and/or ``hierarchy_group_form`` to the ``ckan.plugins`` setting in your CKAN\n   config file (by default the config file is located at\n   ``/etc/ckan/default/production.ini``). Note that hierarchy_display\nshould come before hierarchy_form and hierarchy_group_form\n\n   e.g.:\n\n       ckan.plugins = stats text_view recline_view ... hierarchy_display hierarchy_form hierarchy_group_form\n\n4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:\n\n        sudo service apache2 reload\n\n## Config settings\n\nNone at present\n\n## Tests\n\nTo run the tests, do::\n\n    nosetests --nologcapture --with-pylons=test.ini\n\nTo run the tests and produce a coverage report, first make sure you have\ncoverage installed in your virtualenv (``pip install coverage``) then run::\n\n    nosetests --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.hierarchy --cover-inclusive --cover-erase --cover-tests\n\n\n## Releasing a new version of ckanext-hierarchy\n\nckanext-hierarchy should be available on PyPI as https://pypi.org/project/ckanext-hierarchy.\nTo publish a new version to PyPI follow these steps:\n\n1. Update the version number in the ``setup.py`` file.\n   See `PEP 440 <http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers>`_\n   for how to choose version numbers.\n\n2. Make sure you have the latest version of necessary packages:\n\n       pip install --upgrade setuptools wheel twine\n\n3. Create a source and binary distributions of the new version:\n\n       python setup.py sdist bdist_wheel && twine check dist/*\n\n   Fix any errors you get.\n\n4. Upload the source distribution to PyPI:\n\n       twine upload dist/*\n\n5. Commit any outstanding changes:\n\n       git commit -a\n\n6. Tag the new release of the project on GitHub with the version number from\n   the ``setup.py`` file. For example if the version number in ``setup.py`` is\n   0.0.1 then do:\n\n       git tag 0.0.1\n       git push --tags\n\n## Licence and copyright\n\nThis module is openly licensed with AGPLv3 - see LICENSE file.\n\nCopyright belongs to commit authors. Commits 2013-2017 by @davidread are Crown Copyright.\n",
    "bugtrack_url": null,
    "license": "AGPL",
    "summary": "CKAN Organization hierarchy - templates and configuration",
    "version": "1.2.0",
    "split_keywords": [
        "ckan"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec3f1a39268abc35a08b58855733c5edd8e4798c561a0140be28fada83969115",
                "md5": "78628583a4970490926c042e43cb98f3",
                "sha256": "1344430ce8f3d48277b254f8e36b60949a1d0431ce86b104b79eb2305a6f3092"
            },
            "downloads": -1,
            "filename": "ckanext_hierarchy-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "78628583a4970490926c042e43cb98f3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 36473,
            "upload_time": "2023-04-05T21:12:27",
            "upload_time_iso_8601": "2023-04-05T21:12:27.447760Z",
            "url": "https://files.pythonhosted.org/packages/ec/3f/1a39268abc35a08b58855733c5edd8e4798c561a0140be28fada83969115/ckanext_hierarchy-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed85ce6ccba75807e4b2420a46b78aeb8bb68c00637f8f97b700992ac92d1b16",
                "md5": "ed8b30cf91cb85f94a776d7935b52f1a",
                "sha256": "51abeaccfecb443041ca6f00adad2630026dbe59568dc8c67955ff1933fc2f58"
            },
            "downloads": -1,
            "filename": "ckanext-hierarchy-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ed8b30cf91cb85f94a776d7935b52f1a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 31364,
            "upload_time": "2023-04-05T21:12:28",
            "upload_time_iso_8601": "2023-04-05T21:12:28.868061Z",
            "url": "https://files.pythonhosted.org/packages/ed/85/ce6ccba75807e4b2420a46b78aeb8bb68c00637f8f97b700992ac92d1b16/ckanext-hierarchy-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-05 21:12:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "davidread",
    "github_project": "ckanext-hierarchy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "ckanext-hierarchy"
}
        
Elapsed time: 0.07750s