Skip to content
Snippets Groups Projects
Commit 89ba3b12 authored by Jean-Philippe Laverdure's avatar Jean-Philippe Laverdure
Browse files

Merge branch '104-display-fields-breaks-if-hstore-field-set-to-empty' into 'master'

Resolve "Display fields selection widget breaks if hstore field set to empty / {}"

Closes #104

See merge request !47
parents 691d4759 27b7972e
Branches 162-rm-dependence-to-python2
No related tags found
1 merge request!47Resolve "Display fields selection widget breaks if hstore field set to empty / {}"
......@@ -12,7 +12,7 @@
$(function() {
$('#div_id_options :checkbox').change(function() {
let val = $("#id_display_fields").val();
if ('' == val) {
if ('' == val || '{}' == val) {
// Set default value
val = '{"fields": ""}'
}
......@@ -35,4 +35,4 @@
});
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
......@@ -221,7 +221,7 @@ class DataSetDetailsView(LoginRequiredMixin, DetailView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
dataset = self.get_object()
if dataset.display_fields:
if 'fields' in dataset.display_fields and dataset.display_fields['fields']:
fields = [f.strip() for f in dataset.display_fields['fields'].split(',')]
context['headers'] = [ugettext(h.capitalize().replace('_', ' ')) for h in fields]
context['rows'] = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment