[ckan-dev] custom fields
Nigel Babu
nigel.babu at okfn.org
Thu Mar 13 07:36:05 UTC 2014
Hi Fabrizio,
When you create a custom field, it's stored in the extras table in the
database, but ckan exposes it you as a different field in the data_dict.
You need to deal with changing the templates to show them. You can see how
the templates have been modified in the example_idatasetform plugin.
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 12 March 2014 20:08, Fabrizio Fornari <ckanappoggio at gmail.com> wrote:
> Hi guys!
>
> I am adding some custom fields to my dataset and I am following
> example_idatasetform<https://github.com/ckan/ckan/tree/release-v2.0/ckanext/example_idatasetform>, I
> tried to re-adapt it, and I can insert the new fields but the user can't
> visualize them, they are not under "Additional Info" in the dataset page.
>
> I am using convert_to_extras under _modify_package_schema and
> convert_from_extras under _show_package_schema.
>
> Shouldn't those lines (below) in
> ckan/templates/package/snippets/additional_info.html show the custom fields
> that I added?
>
>
> {% block extras scoped %}
> {% for extra in h.sorted_extras(pkg_dict.extras) %}
> {% set key, value = extra %}
> <tr rel="dc:relation" resource="_:extra{{ i }}">
>
> <th scope="row" class="dataset-label" property="rdfs:label">{{ _(key) }}</th>
>
> <td class="dataset-details" property="rdf:value">{{ value }}</td>
>
> </tr>
> {% endfor %}
>
> {% endblock %}
>
>
>
>
>
>
> _______________________________________________
> 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/20140313/8534751f/attachment-0003.html>
More information about the ckan-dev
mailing list