[ckan-dev] How to properly add new fields with ckanext-scheming

Forum forum at hello-web.net
Fri Sep 30 09:10:59 UTC 2016


Dear All

I succesfully installed ckanext-scheming and I could add a basic field 
to a dataset.
I copied ckan_dataset.json to dataset.json and I am working with 
dataset.json.

In dataset.json, I added the followint lines:

/    {//
//      "field_name": "publication_status",//
//      "label": "Publication status",//
//      "form_snippet": "publication_status.html",//
//      "form_placeholder": "eg. Publication status"//
//    },//
//    {//
//      "field_name": "dio",//
//      "label": "DIO",//
//      "form_placeholder": "eg. DIO"//
//    },/

I would like to have a dropdown menu for 'publication status'. Then I 
copied

/usr/lib/ckan/default/src/ckanext-scheming/ckanext/scheming/templates/scheming/form_snippets/license.html 


to

/usr/lib/ckan/default/src/ckanext-scheming/ckanext/scheming/templates/scheming/form_snippets/publication_status.html

I reloaded the apache2 service *and of course* I got the same dropdown 
menu as license.


*From now I would like to know how can I modified*

/usr/lib/ckan/default/src/ckanext-scheming/ckanext/scheming/templates/scheming/form_snippets/publication_status.html

to have a dropdown options for my publications.

Where

{% call form.select(
     field.field_name,
     id='field-' + field.field_name,
     label=h.scheming_language_text(field.label),
     options=options,
     selected=data.get(field.field_name, field.get('default', 
'notspecified')),
     error=errors[field.field_name],
     classes=['control-medium'],
     attrs=field.form_attrs if 'form_attrs' in field else {},
     is_required=h.scheming_field_required(field),
     )
%}

is looking for the correct dropdown options?

And where/how can I set my dropdown option as the following

Published
Reviewed article
Non-reviewed article


How should I do better and properly?

Many thank for your help!!!
Cheers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160930/73246e72/attachment-0002.html>


More information about the ckan-dev mailing list