[1720][forms, templates] Don't show tags with vocabularies
in standard 'tags' listing
--- a/ckanext/example/forms.py
+++ b/ckanext/example/forms.py
@@ -1,9 +1,8 @@
import os, logging
from ckan.authz import Authorizer
from ckan.logic.converters import convert_to_extras,\
- convert_from_extras, convert_to_tags, convert_from_tags
+ convert_from_extras, convert_to_tags, convert_from_tags, free_tags_only
from ckan.logic.schema import package_form_schema, group_form_schema
-from ckan.model import vocabulary
from ckan.lib.base import c, model
from ckan.plugins import IDatasetForm, IGroupForm, IConfigurer, IConfigurable
from ckan.plugins import implements, SingletonPlugin
@@ -209,7 +208,7 @@
schema = package_form_schema()
schema.update({
'tags': {
- '__extras': [keep_extras]
+ '__extras': [keep_extras, free_tags_only]
},
'vocab_tag_string': [convert_from_tags(self.vocab_name), ignore_missing],
'published_by': [convert_from_extras, ignore_missing],
--- a/ckanext/example/theme/templates/forms/dataset_form.html
+++ b/ckanext/example/theme/templates/forms/dataset_form.html
@@ -137,7 +137,7 @@
<dt class="tags-label"><label class="field_opt" for="tags">Tags</label></dt>
<dd class="tags-field">
<input class="long autocomplete-tag" id="tag_string" name="tag_string" size="60" type="text"
- value="${data.get('tag_string') or ', '.join([tag['name'] for tag in data.get('tags', [])])}" />
+ value="${data.get('tag_string') or ', '.join([tag['name'] for tag in data.get('tags', []) if not tag.get('vocabulary_id')])}" />
</dd>
<dd class="tags-instructions instructions basic" i18n:msg="">Comma-separated terms that may link this dataset to similar ones. For more information on conventions, see <a href="http://wiki.okfn.org/ckan/doc/faq#TagConventions">this wiki page</a>.</dd>
<dd class="tags-instructions hints">e.g. pollution, rivers, water quality</dd>