Skip to content

Commit

Permalink
fix for notes not being displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
wardi committed Jul 29, 2015
1 parent e4941f5 commit 8e83c0e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions ckanext/scheming/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,13 @@ def scheming_get_organization_schema(organization_type, expanded=True):
schemas = scheming_organization_schemas(expanded)
if schemas:
return schemas.get(organization_type)


def scheming_field_by_name(fields, name):
"""
Simple helper to grab a field from a schema field list
based on the field name passed. Returns None when not found.
"""
for f in fields:
if f.get('field_name') == name:
return f
2 changes: 2 additions & 0 deletions ckanext/scheming/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def get_helpers(self):
helpers.scheming_organization_schemas,
'scheming_get_organization_schema':
helpers.scheming_get_organization_schema,
'scheming_field_by_name':
helpers.scheming_field_by_name,
}

def get_validators(self):
Expand Down
3 changes: 2 additions & 1 deletion ckanext/scheming/templates/scheming/package/read.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
might not be compatible with ckanext-scheming
</p>
{%- endif -%}
{% if 'notes' in schema.dataset_fields and c.pkg_notes_formatted %}
{% if h.scheming_field_by_name(schema.dataset_fields, 'notes') and
c.pkg_notes_formatted %}
<div class="notes embedded-content">
{{ c.pkg_notes_formatted }}
</div>
Expand Down

0 comments on commit 8e83c0e

Please sign in to comment.