Add checkbox 'Add more' to frontend

This commit is contained in:
Edgar P. Burkhart 2023-04-20 09:39:40 +02:00
parent 3ca027afc5
commit 306a1e06c2
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 9 additions and 18 deletions

View file

@ -22,6 +22,15 @@
{% endfor %}
</tbody>
<tfoot class="buttons">
<tr>
<td colspan="2">
<label for="addmore">{% translate "Add another" %}</label>
<input type="checkbox"
name="addmore"
id="addmore"
{% if form.instance.adding %}checked{% endif %} />
</td>
</tr>
<tr>
<td colspan="2">
{% block buttons %}

View file

@ -1,9 +0,0 @@
{% load i18n %}
<div class="buttons">
{% if not adding %}
{% translate "Delete" as del %}
<a class="btn del" href="{% url del_url instance.id %}">{{ del }}</a>
{% endif %}
<input type="reset" />
<input type="submit" value="{% translate 'Save' %}" />
</div>

View file

@ -33,15 +33,6 @@ def pmrvalue(val):
return value(val, True, r=0)
@register.inclusion_tag("main/tag/form_buttons.html")
def form_buttons(instance):
return {
"instance": instance,
"adding": instance._state.adding,
"del_url": f"del_{instance.__class__.__name__.lower()}",
}
@register.filter
def remix(icon):
return mark_safe(f"""<span class="ri-{icon}-line"></span>""")