Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: retain extra fields #14

Open
florianm opened this issue Dec 16, 2014 · 7 comments
Open

Feature request: retain extra fields #14

florianm opened this issue Dec 16, 2014 · 7 comments

Comments

@florianm
Copy link
Contributor

Not sure whether this is a bug or a feature, but it seems that enabling ckanext-scheming with a custom schema will, on first saving a dataset with the new schema, delete any existing "extra" fields. Even to only retain the existing extra fields to safely migrate data would be helpful - this could be achieved if config settings would toggle the display of existing extra fields and/or form fields.

@wardi
Copy link
Contributor

wardi commented Dec 18, 2014

Just not yet implemented.

The way I'm using scheming I don't want free-form extras, but many users would like to still offer support and the combining schema extras and free-form extras should work with the latest ckan master. We should have a way to specify if free-form dataset extras should be allowed with a schema.

@florianm
Copy link
Contributor Author

Cool, no worries. I've got some prod data in extra fields which is tricky to migrate as any edit to a dataset with scheming fields deletes any extra fields. Would be great to choose from displaying extra fields or not, and retaining them (or not). Had a look in the code but couldn't figure out where the magic needs to happen :-)

@florianm
Copy link
Contributor Author

@wardi as scheming disables free-form extra fields, and harvesting requires them, what's the path of least resistance to ckan_harvest between two ckan instances with (easy: the same, harder: different) custom dataset schemas?

@wardi
Copy link
Contributor

wardi commented Aug 23, 2015

@florianm free-form extras should work if we just add the edit fields back to the template. Care to give that a try?

The only problem is: how do we handle free-form extras with names that match the ones in the schema?

@CarlQLange
Copy link

Just in case someone wants this (and I think lots do), here's a copy-pastable solution:

In ckanext-scheming/ckanext/scheming/templates/scheming/package/snippets/package_form.html

from

{% block metadata_fields %}
{% endblock %}

to

{% block metadata_fields %}
  {% block package_metadata_fields_custom %}
    {% block custom_fields %}
      {% snippet 'snippets/custom_form_fields.html', extras=data.extras, errors=errors, limit=3 %}
    {% endblock %}
  {% endblock %}
{% endblock %}

@NicolaiLolansen
Copy link

@CarlQLange Thanks a lot, this works just fine (y)

@GordianDziwis
Copy link

@wardi There is already logic which checks if a key is defined in the root or under extras.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants