[ckan-dev] How to properly add new fields with ckanext-scheming
Forum
forum at hello-web.net
Fri Sep 30 12:43:18 UTC 2016
Dera Ian,
Thank fro your advise
Cheers
On 9/30/16 2:04 PM, Ian Ward wrote:
> You shouldn't need to customize any snippets, just add a field with
> the a select form_snippet, like in:
>
> https://github.com/ckan/ckanext-scheming/blob/master/ckanext/scheming/camel_photos.json#L24-L52
>
> On Fri, Sep 30, 2016 at 5:10 AM, Forum <forum at hello-web.net> wrote:
>> 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
>>
>>
>> _______________________________________________
>> 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
More information about the ckan-dev
mailing list