Remove addmore checkbox from update forms
This commit is contained in:
parent
e3ddf4cbaa
commit
3eb40cd5ed
2 changed files with 9 additions and 14 deletions
|
@ -23,15 +23,14 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
{% block buttons %}
|
{% block buttons %}
|
||||||
|
{% if form.instance.adding %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<label for="addmore">{% translate "Add another" %}</label>
|
<label for="addmore">{% translate "Add another" %}</label>
|
||||||
<input type="checkbox"
|
<input type="checkbox" name="addmore" id="addmore" checked />
|
||||||
name="addmore"
|
|
||||||
id="addmore"
|
|
||||||
{% if form.instance.adding %}checked{% endif %} />
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% endif %}
|
||||||
<tr class="buttons">
|
<tr class="buttons">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
{% if not form.instance.adding %}
|
{% if not form.instance.adding %}
|
||||||
|
|
|
@ -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):
|
||||||
|
|
Loading…
Reference in a new issue