Skip to content

Commit

Permalink
[geo] Treat extras with __ as start of key as system (hidden)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed May 15, 2013
1 parent 65e6c35 commit dea7c12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ckan/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ def sorted_extras(package_extras, auto_clean=False, subs=None, exclude=None):
if extra.get('state') == 'deleted':
continue
k, v = extra['key'], extra['value']
if k in exclude:
if k in exclude or k.startswith('__'):
continue
if subs and k in subs:
k = subs[k]
Expand Down
6 changes: 6 additions & 0 deletions ckan/templates/macros/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@
{%- set extra_html = caller() if caller -%}
{%- do classes.append('control-custom') -%}

{# if the key starts with __ we hide it as it is a system setting #}
{% if (values[0] and values[0].startswith('__')) %}
<input id="{{ id or names[0] }}-key" type="hidden" name="{{ names[0] }}" value="{{ values[0] | empty_and_escape }}" />
<input id="{{ id or names[1] }}-value" type="hidden" name="{{ names[1] }}" value="{{ values[1] | empty_and_escape }}" />
{% else %}
{% call input_block(label_id, label or name, error, classes, control_classes=["editor"], extra_html=extra_html) %}
<div class="input-prepend" {{ attributes(attrs) }}>
<label for="{{ label_id }}" class="add-on">Key</label><input id="{{ id or names[0] }}-key" type="text" name="{{ names[0] }}" value="{{ values[0] | empty_and_escape }}" placeholder="{{ placeholders[0] }}" />
Expand All @@ -228,6 +233,7 @@
{% endif %}
</div>
{% endcall %}
{% endif %}
{% endmacro %}

{#
Expand Down

0 comments on commit dea7c12

Please sign in to comment.