def get_dataset_tracking_summary(self, dataset_id):
context = {'ignore_auth': True, 'use_cache': False}
result = get_action('package_show')(context, {'id': dataset_id})
tracking_summary = result.get('tracking_summary', {})
return tracking_summary
def update_config(self, config: CKANConfig):
# Add this plugin's templates dir to CKAN's extra_template_paths, so
# that CKAN will use this plugin's custom templates.
# 'templates' is the path to the templates dir, relative to this
# plugin.py file.
toolkit.add_template_directory(config, 'templates')
def is_fallback(self):
return True
def get_helpers(self):
# Return the custom helper function in the template context
return {
'get_dataset_tracking_summary': self.get_dataset_tracking_summary
}
written this code in plugin.py and below code to template file. {% set tracking_summary = get_dataset_tracking_summary(package.id) %}
Views: {{ tracking_summary.total }} but showing the error template not found and get_dataset_tracking_summary is undefined
I was expecting tracking_summary of dataset along with each dataset