[ckan-dev] Customize CKAN on a kind of deeper level

Rufus Pollock rufus.pollock at okfn.org
Tue Nov 1 13:34:46 UTC 2011


On 28 October 2011 17:09, Max Ludwig <maxe.ludwig at googlemail.com> wrote:
> Hi,

Sorry for slightly slow reply!

> it's been a long time but I have now an instance of CKAN 1.5.1a running and
> I'm currently exploring what's the best way to customize it for our needs.
> One of the main points is, that we need two types of datasets ("Institution"
> and "Project"). Unfortunatly the current domain model doesn't seem to map
> this appropriately and we can't really wait for v2 of the domain model which
> - as I saw - would do the job.

Institution would surely map to Group while Project would map to
"Dataset". We already have deployments supporting the first mapping
and the second is "just" a mapping question. I also note we are in
final stages of planning the "Groups Refactor" which is the major part
of of Domain Model v2: <http://wiki.ckan.org/Groups_Refactor>

> What I thought of, is: I just set a "type" attribute in an "extra" field. So
> I created an extension and a custom template for creating a dataset based on
> the original one. Although this may sound pretty easy, it was not. It took
> hours to understand what's going on in the templates (partly because the
> documentation on writing an extension is quite sparse and outdated) but I
> think I got the clue now. I added a fieldset for my "type" field in the

Any feedback on what we should improve there is very welcome (however
critical!) :-)

> new_package_form.html template which looks now like this (see line 33 to 37
> for my
> additions): http://pylonshq.com/pasties/b15acf6df376a3fc257259ce8427d90e
> I naively hoped that this would be enough to add an "extra" field to the
> package. It is not :P

It's a little tricky to see what you've changed there. Could you
highlight what you've added / removed?

> So now my question is: is the way I'm going the right one? Because as far as
> I can see now I have to custumize a lot more forms. And if I should keep on
> working with that approach, how can I actually save my extra "type" field?

This should be reasonably straightforward. If you ever can drop in to
ckan-dev I can try and assist in putting this together. In addition if
I have a moment, I'll try to put together a simple example of doing
this.

Rufus

> Thanks in advance
> Max
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
>
>



-- 
Co-Founder, Open Knowledge Foundation
Promoting Open Knowledge in a Digital Age
http://www.okfn.org/ - http://blog.okfn.org/




More information about the ckan-dev mailing list