diff --git a/openslides/agenda/forms.py b/openslides/agenda/forms.py index 783398765..00a48281e 100644 --- a/openslides/agenda/forms.py +++ b/openslides/agenda/forms.py @@ -21,7 +21,7 @@ from openslides.utils.person.forms import PersonFormField from .models import Item, Speaker -class ItemForm(forms.ModelForm, CssClassMixin): +class ItemForm(CssClassMixin, forms.ModelForm): """ Form to create of update an item. """ @@ -40,7 +40,16 @@ class ItemForm(forms.ModelForm, CssClassMixin): exclude = ('closed', 'weight', 'related_sid') -class ItemOrderForm(forms.Form, CssClassMixin): +class RelatedItemForm(ItemForm): + """ + Form to update an related item. + """ + class Meta: + model = Item + exclude = ('closed', 'type', 'weight', 'related_sid', 'title', 'text') + + +class ItemOrderForm(CssClassMixin, forms.Form): """ Form to change the order of the items. """ diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 711d58639..8d347f381 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -114,19 +114,13 @@ class Item(MPTTModel, SlideMixin): def get_absolute_url(self, link='detail'): """ - Return the URL to this item. By default it is the link to its - view or the view of a related object. + Return the URL to this item. - The link can be: - * detail or view - * update or edit - * delete + The link can be detail, update or delete. """ if link == 'detail' or link == 'view': return reverse('item_view', args=[str(self.id)]) if link == 'update' or link == 'edit': - if self.related_sid: - return self.get_related_slide().get_absolute_url(link) return reverse('item_edit', args=[str(self.id)]) if link == 'delete': return reverse('item_delete', args=[str(self.id)]) diff --git a/openslides/agenda/templates/agenda/edit.html b/openslides/agenda/templates/agenda/edit.html index 9d5a8065b..081caaed5 100644 --- a/openslides/agenda/templates/agenda/edit.html +++ b/openslides/agenda/templates/agenda/edit.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% load i18n %} +{% load tags %} {% block title %} {% if item %} @@ -22,6 +23,15 @@ {% trans "Back to overview" %} +
+ {% if item.related_sid %} + + {% blocktrans with type=item.get_related_type|trans name=item.get_related_slide %} + Edit {{ type }} {{ name }} + {% endblocktrans %} + + {% endif %} +