Skip to content
Snippets Groups Projects
Commit 59b18141 authored by Thorge Petersen's avatar Thorge Petersen
Browse files

Calculate length of custom dataset extras instead using harcoded value

parent 5c4b15de
Branches
Tags
No related merge requests found
......@@ -47,8 +47,9 @@
{{ form.input_address('gnd','GND URI', value=extras.gnd, index=6, placeholder='https://d-nb.info/gnd/1136109587', type='text', attrs={}) }}
{% for extra in data.extras %}
{% if extra.key not in ['person','street','location','telephone','mail','web','gnd'] %}
{% set prefix = 'extras__%d__' % (loop.index0 + 7) %}
{% set custom_extras = ['person','street','location','telephone','mail','web','gnd'] %}
{% if extra.key not in custom_extras %}
{% set prefix = 'extras__%d__' % (loop.index0 + (custom_extras|count)) %}
{{ form.custom(
names=(prefix ~ 'key', prefix ~ 'value', prefix ~ 'deleted'),
id='field-extras-%d' % loop.index,
......@@ -65,7 +66,7 @@
{% if empty_extras <= 0 %}{% set empty_extras = 1 %}{% endif %}
{% for extra in range(total_extras, total_extras + empty_extras) %}
{% set index = loop.index0 + (data.extras|count) + 7 %}
{% set index = loop.index0 + (data.extras|count) + (custom_extras|count) %}
{% set prefix = 'extras__%d__' % index %}
{{ form.custom(
names=(prefix ~ 'key', prefix ~ 'value', prefix ~ 'deleted'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment