Create view returns to create another ; remove checkbox
This commit is contained in:
parent
3eb40cd5ed
commit
9263af0d40
4 changed files with 15 additions and 31 deletions
|
@ -22,25 +22,17 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
{% block buttons %}
|
||||
{% if form.instance.adding %}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<label for="addmore">{% translate "Add another" %}</label>
|
||||
<input type="checkbox" name="addmore" id="addmore" checked />
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr class="buttons">
|
||||
<td colspan="2">
|
||||
<tr class="buttons">
|
||||
<td colspan="2">
|
||||
{% block buttons %}
|
||||
{% if not form.instance.adding %}
|
||||
<a class="del" href="{{ form.instance.get_delete_url }}">{% translate "Delete" %}</a>
|
||||
{% endif %}
|
||||
<input type="reset" value="{% translate "Reset" %}" />
|
||||
<input type="submit" value="{% translate "Save" %}" />
|
||||
</td>
|
||||
</tr>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
{% extends "main/form/base.html" %}
|
||||
{% load i18n %}
|
||||
{% block buttons %}
|
||||
<tr class="buttons">
|
||||
<td colspan="2">
|
||||
<input hidden value="{{ next }}" name="next" />
|
||||
<input type="reset" />
|
||||
<input type="submit" value="{% translate "Log in" %}" />
|
||||
</td>
|
||||
</tr>
|
||||
<input hidden value="{{ next }}" name="next" />
|
||||
<input type="reset" />
|
||||
<input type="submit" value="{% translate "Log in" %}" />
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
{% extends "main/form/base.html" %}
|
||||
{% load i18n %}
|
||||
{% block buttons %}
|
||||
<tr class="buttons">
|
||||
<td colspan="2">
|
||||
<input type="reset" />
|
||||
<input type="submit" value="{% translate "Search" %}" />
|
||||
</td>
|
||||
</tr>
|
||||
<input type="reset" />
|
||||
<input type="submit" value="{% translate "Search" %}" />
|
||||
{% endblock %}
|
||||
|
|
|
@ -71,12 +71,12 @@ class UserFormMixin:
|
|||
|
||||
|
||||
class NummiCreateView(UserMixin, UserFormMixin, CreateView):
|
||||
def get_success_url(self):
|
||||
return self.object.get_create_url()
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.user = self.request.user
|
||||
_res = super().form_valid(form)
|
||||
if form.data["addmore"]:
|
||||
return HttpResponseRedirect(self.object.get_create_url())
|
||||
return _res
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
class NummiUpdateView(UserMixin, UserFormMixin, UpdateView):
|
||||
|
|
Loading…
Reference in a new issue