Add checkbox 'Add more' to frontend
This commit is contained in:
parent
3ca027afc5
commit
306a1e06c2
3 changed files with 9 additions and 18 deletions
|
@ -22,6 +22,15 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot class="buttons">
|
<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>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
{% block buttons %}
|
{% block buttons %}
|
||||||
|
|
|
@ -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>
|
|
|
@ -33,15 +33,6 @@ def pmrvalue(val):
|
||||||
return value(val, True, r=0)
|
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
|
@register.filter
|
||||||
def remix(icon):
|
def remix(icon):
|
||||||
return mark_safe(f"""<span class="ri-{icon}-line"></span>""")
|
return mark_safe(f"""<span class="ri-{icon}-line"></span>""")
|
||||||
|
|
Loading…
Reference in a new issue