4

I want to change mysite.org/organization/someinstitution to mysite.org/institution/someinstitution

In ckan/ckan/config/routing.py the urls are defined like this:

m.connect('organization_read', '/organization/{id}', action='read')

Is there a way to change this using an extension or by any other means?, I don't want to modify the master branch.

Urkonn
  • 90
  • 6

1 Answers1

4

Update: The current best way to implement custom organization types is to use ckanext-scheming, as described here. This will automatically register all the appropriate routes for you.


It is not as straight-forward as datasets with the IDatasetForm interface, but you can change the /organization URLs to /institution by changing the routing with the IRoutes interface.

Here is an example that changes /organization to /publisher:

https://github.com/IATI/ckanext-iati/blob/b26d2cd518f3991f3c3c954819a582393d9a7e35/ckanext/iati/plugins.py#L69:L103

amercader
  • 4,490
  • 2
  • 24
  • 26
  • Thanks for your answer @amercader. So the only thing I have to do is to bind **ckan.controllers.organization:OrganizationController** to the desired routes? – Urkonn Sep 22 '14 at 17:09
  • Yes, the example shows how to essentially replace all the core routes for the organization controller with custom ones on your extension – amercader Sep 23 '14 at 10:49
  • Updated link to above from this time period for those stumbling on this now. https://github.com/IATI/ckanext-iati/blob/b26d2cd518f3991f3c3c954819a582393d9a7e35/ckanext/iati/plugins.py#L69:L103 – user3366016 Jun 30 '20 at 20:32
  • 1
    Thanks @user3366016, updated the answer with the current recommended approach – amercader Jul 02 '20 at 08:24