[ckan-dev] ckan form - help

Nigel Babu nigel.babu at okfn.org
Thu Feb 6 09:30:02 UTC 2014


Hi Kristi,

You'd have to override the resource form to add your new field.

Nigel Babu

Developer  |  @nigelbabu <https://twitter.com/nigelbabu>

The Open Knowledge Foundation <http://okfn.org/>

Empowering through Open Knowledge

http://okfn.org/  |  @okfn <http://twitter.com/OKFN>  |  OKF on
Facebook<https://www.facebook.com/OKFNetwork> |
Blog <http://blog.okfn.org/>  |  Newsletter<http://okfn.org/about/newsletter>

 CKAN | http://ckan.org/ | @CKANproject
<http://twitter.com/CKANproject> |the world’s leading open-source data
portal platform


On 6 February 2014 01:59, kristi powell <y2kristi at hotmail.com> wrote:

> Thanks David, that does imply that I cannot add a form field?
>
> So the dataset form in step 2 adds a resource and there is where I am
> trying to add an additional field.
>
>
> ------------------------------
> From: David.Fawcett at state.mn.us
> To: ckan-dev at lists.okfn.org
> Date: Wed, 5 Feb 2014 20:21:01 +0000
>
> Subject: Re: [ckan-dev] ckan form - help
>
>  Yes, you can add ‘extras’ to resources:
> http://stackoverflow.com/questions/15709586/attach-extras-to-ckan-resources
>
>
>
> Note that the API syntax is different for resources than for
> packages/datasets.
>
>
>
> David.
>
>
>
> *From:* ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] *On Behalf Of *kristi
> powell
> *Sent:* Wednesday, February 05, 2014 2:00 PM
> *To:* CKAN Development Discussions
> *Subject:* Re: [ckan-dev] ckan form - help
>
>
>
> Ok, can you add a field to a resource?
>
>
>  ------------------------------
>
> Date: Wed, 5 Feb 2014 14:03:29 -0500
> From: stephane at opennorth.ca
> To: ckan-dev at lists.okfn.org
> Subject: Re: [ckan-dev] ckan form - help
>
> Hi Kristi,
>
>
>
> I am not sure of all the intrinsicalities of CKAN, but it does not change
> change de tables. If I remember well, there is a table of "extras" where
> CKAN stores the field name and values of the additional fields. A new field
> can also be defined as a tag (in which case it goes with a defined
> vocabulary, it's a bit more complex).
>
>
>
> In the example, you see this happen here:
>
>
>
>    *def* *_modify_package_schema*(self, schema):
>
>
>
>          *# Add our custom country_code metadata field to the schema.*
>
>
>
>         schema*.*update({
>
>                  'country_code': [tk*.*get_validator('ignore_missing'),
>
>
>
>                      tk*.*get_converter('*convert_to_tags*')('country_codes')]
>
>
>
>                  })
>
>          *# Add our custom_test metadata field to the schema, this one will use*
>
>
>
>          *# convert_to_extras instead of convert_to_tags.*
>
>
>
>         schema*.*update({
>
>                  'custom_text': [tk*.*get_validator('ignore_missing'),
>
>
>
>                      tk*.*get_converter('*convert_to_extras*')]
>
>
>
>                  })
>
>          *return* schema
>
>
>
>
>
> Basically, it adds extras (or tags) from the DB to the data schema that is
> made available.
>
>
>
> Steph
>
>
>
>
>
> On Wed, Feb 5, 2014 at 1:34 PM, kristi powell <y2kristi at hotmail.com>
> wrote:
>
> Thanks Steph.
>
>
>
> Is there a new field added to one of the ckan database tables or is a new
> table created?
>
>
>
> Kristi
>
>
>  ------------------------------
>
> Date: Wed, 5 Feb 2014 12:30:02 -0500
> From: stephane at opennorth.ca
> To: ckan-dev at lists.okfn.org
> Subject: Re: [ckan-dev] ckan form - help
>
>
>
> Hi Kristi,
>
>
>
> Did you had a look to the idatasetform example :
> https://github.com/ckan/ckan/tree/master/ckanext/example_idatasetform
>
>
>
> You have there a perfect example to add fields.
>
>
>
> Steph
>
>
>
> On Wed, Feb 5, 2014 at 11:31 AM, kristi powell <y2kristi at hotmail.com>
> wrote:
>
> I've registered...
>
>
>
> I'm new to using ckan.  The new dataset form is pretty comprehensive, but
> I need 3 additional fields to be added.  I have read that it is not
> recommended to change the schema of the db tables, so i'm trying to create
> an extension.
>
>
>
> For the fields that I needed added I can't seem to change the html file.
>  Am I expected to override the function in my python script and construct
> an entire new html form?  If I create a new html form am I responsible for
> writing the code to update the original ckan schema or just the fields that
> i'm adding.
>
>
>
>
>
>
>
> Subject: ckan form - help
> From: ckan-dev-owner at lists.okfn.org
> To: y2kristi at hotmail.com
> Date: Wed, 5 Feb 2014 16:10:12 +0000
>
> Only list members can post to the ckan-dev mailing list. Please join
> the list to post.
>
>
>
> --Forwarded Message Attachment--
> From: y2kristi at hotmail.com
> To: ckan-dev at lists.okfn.org
> Subject: ckan form - help
> Date: Wed, 5 Feb 2014 11:10:09 -0500
>
> Hello,
>
>
>
> I'm new to using ckan.  The new dataset form is pretty comprehensive, but
> I need 3 additional fields to be added.  I have read that it is not
> recommended to change the schema of the db tables, so i'm trying to create
> an extension.
>
>
>
> For the fields that I needed added I can't seem to change the html file.
>  Am I expected to override the function in my python script and construct
> an entire new html form?  If I create a new html form am I responsible for
> writing the code to update the original ckan schema or just the fields that
> i'm adding.
>
>
>
> Any help would be greatly appreciated.
>
>
>
> Thanks,
>
>
>
> Kristi
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
>
>
> _______________________________________________ ckan-dev mailing list
> ckan-dev at lists.okfn.org https://lists.okfn.org/mailman/listinfo/ckan-devUnsubscribe:
> https://lists.okfn.org/mailman/options/ckan-dev
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
>
>
>
> --
>
> Stéphane Guidoin
>
> Director, Transportation
> Open North
>
> 514-862-0084
>
> http://opennorth.ca
>
> Twitter: @opennorth / @hoedic
>
>
> _______________________________________________ ckan-dev mailing list
> ckan-dev at lists.okfn.org https://lists.okfn.org/mailman/listinfo/ckan-devUnsubscribe:
> https://lists.okfn.org/mailman/options/ckan-dev
>
> _______________________________________________ ckan-dev mailing list
> ckan-dev at lists.okfn.org https://lists.okfn.org/mailman/listinfo/ckan-devUnsubscribe:
> https://lists.okfn.org/mailman/options/ckan-dev
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140206/ccd94cdb/attachment-0003.html>


More information about the ckan-dev mailing list