diff --git a/openslides/agenda/templates/agenda/edit.html b/openslides/agenda/templates/agenda/edit.html index 8230b728a..6285cdcd3 100644 --- a/openslides/agenda/templates/agenda/edit.html +++ b/openslides/agenda/templates/agenda/edit.html @@ -5,7 +5,11 @@ {% block title %}{{ block.super }} - {%trans "Item" %}{% endblock %} {% block content %} -

{%trans "Edit item" %}

+ {% if item %} +

{%trans "Edit item" %}

+ {% else %} +

{%trans "New item" %}

+ {% endif %}
{% csrf_token %} {{ form.as_p }}

diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py index 64e63afcf..8f88dad1c 100644 --- a/openslides/agenda/views.py +++ b/openslides/agenda/views.py @@ -105,6 +105,13 @@ class ItemUpdate(UpdateView): context_object_name = 'item' form_class = ItemForm success_url = 'item_overview' + apply_url = 'item_edit' + + def get_success_url(self): + messages.success(self.request, _("Item %s was successfully modified.") % self.request.POST['title']) + if 'apply' in self.request.POST: + return '' + return reverse(super(UpdateView, self).get_success_url()) class ItemCreate(CreateView): @@ -114,6 +121,13 @@ class ItemCreate(CreateView): context_object_name = 'item' form_class = ItemForm success_url = 'item_overview' + apply_url = 'item_edit' + + def get_success_url(self): + messages.success(self.request, _("Item %s was successfully created.") % self.request.POST['title']) + if 'apply' in self.request.POST: + return reverse(self.get_apply_url(), args=[self.object.id]) + return reverse(super(CreateView, self).get_success_url()) class ItemDelete(DeleteView):