[ckan-dev] ckan form - help

kristi powell y2kristi at hotmail.com
Wed Feb 5 19:59:48 UTC 2014


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-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-dev

Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev




-- 
Stéphane GuidoinDirector, Transportation
Open North
514-862-0084
http://opennorth.caTwitter: @opennorth / @hoedic


_______________________________________________
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/20140205/1027efb8/attachment-0003.html>


More information about the ckan-dev mailing list