[ckan-dev] Trouble in including custom made JS file in CKAN

lucia.espona at wsl.ch lucia.espona at wsl.ch
Fri Sep 9 07:02:46 UTC 2016


Dear Bijith

This worked for me:

* place the file example.js in ckanext-myextension/ckanext/myextension/fanstatic/

* add the fanstatic directory as resource:

import ckan.plugins as p
class MyPlugin(p.SingletonPlugin):

    p.implements(p.IConfigurer, inherit=True)

    def update_config(self, config):
        p.toolkit.add_resource('fanstatic', 'myextension')
        
* use it in your template:
  {% resource 'myextension/example.js' %}

I hope it helps.

Best
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

-----"ckan-dev" <ckan-dev-bounces at lists.okfn.org> wrote: -----
To: ckan-dev at lists.okfn.org
From: Bijith komalan 
Sent by: "ckan-dev" 
Date: 07.09.2016 16:53
Subject: [ckan-dev] Trouble in including custom made JS file in CKAN


 
down votefavorite
 I have made a js file , but is not able to include that in my ckan form this is the error I'm getting
AttributeError: 'module' object has no attribute 'example/example.js' 
_______________________________________________
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/20160909/45fa1231/attachment-0003.html>


More information about the ckan-dev mailing list