Remove addmore checkbox from update forms

This commit is contained in:
Edgar P. Burkhart 2023-04-20 11:07:17 +02:00
parent e3ddf4cbaa
commit 3eb40cd5ed
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 9 additions and 14 deletions

View file

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

View file

@ -80,11 +80,7 @@ class NummiCreateView(UserMixin, UserFormMixin, CreateView):
class NummiUpdateView(UserMixin, UserFormMixin, UpdateView): class NummiUpdateView(UserMixin, UserFormMixin, UpdateView):
def form_valid(self, form): pass
_res = super().form_valid(form)
if form.data["addmore"]:
return HttpResponseRedirect(self.object.get_create_url())
return _res
class NummiDeleteView(UserMixin, DeleteView): class NummiDeleteView(UserMixin, DeleteView):