[ckan-dev] Proper way to create a link

lucia.espona at wsl.ch lucia.espona at wsl.ch
Fri Nov 11 15:56:15 UTC 2016


 Dear all,

I am working on an extension that converts the CKAN metadata to a DataCite XML (https://github.com/espona/ckanext-package_converter).

In this first version the XML can be retrieved in two ways:
- Adding "/export/datacite.xml" to the package path, for example: http://www.envidat.ch/dataset/10-16904-2/export/datacite.xml 
- API call: http://www.envidat.ch/api/action/package_export?id=10-16904-2&format=datacite

Now I want to put a button in the package read page that downloads the XML. I did a quick solution that works:
<a href="/dataset/{{c.pkg_dict.get('name')}}/export/datacite.xml" class="btn"><i class="icon-file-text"></i>{{ _('Get DataCite XML')}}</a>

Is there a better/cleaner way to do this?

Thanks,
Lucia


_________________________________________________________
Dr. Lucia Espona Pernas

Swiss Federal Institute for Forest, Snow and Landscape Research WSL
Hauptgebäaude Labortrakt (HL C21)
Zürcherstrasse 111
8903 Birmensdorf
Switzerland

+41 44 739 28 71 phone direct
+41 44 739 21 11 reception

www.wsl.ch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20161111/a63fd10b/attachment-0002.html>


More information about the ckan-dev mailing list