Merge pull request #3659 from FinnStutzenstein/agenda-autoupdates
Autoupdates for all children if the item type has changed (fixes #3636).
This commit is contained in:
commit
1dc4e5ef05
@ -17,6 +17,7 @@ Agenda:
|
|||||||
- New DOCX export of agenda [#3569].
|
- New DOCX export of agenda [#3569].
|
||||||
- Hide closed agenda items in the item slide [#3567].
|
- Hide closed agenda items in the item slide [#3567].
|
||||||
- Agenda is now collapsable for a better overview [#3567].
|
- Agenda is now collapsable for a better overview [#3567].
|
||||||
|
- Autoupdates for all children if the item type has changed [#3659].
|
||||||
|
|
||||||
Motions:
|
Motions:
|
||||||
- New export dialog [#3185].
|
- New export dialog [#3185].
|
||||||
|
@ -58,6 +58,30 @@ class ItemViewSet(ListModelMixin, RetrieveModelMixin, UpdateModelMixin, GenericV
|
|||||||
result = False
|
result = False
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def update(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Customized view endpoint to update all children if, the item type has changed.
|
||||||
|
"""
|
||||||
|
hidden = self.get_object().type == Item.HIDDEN_ITEM
|
||||||
|
|
||||||
|
result = super().update(*args, **kwargs)
|
||||||
|
|
||||||
|
# update all children, if the item type has changed
|
||||||
|
item = self.get_object()
|
||||||
|
if hidden != (item.type == Item.HIDDEN_ITEM):
|
||||||
|
items_to_update = []
|
||||||
|
|
||||||
|
# rekursively add children to items_to_update
|
||||||
|
def add_item(item):
|
||||||
|
items_to_update.append(item)
|
||||||
|
for child in item.children.all():
|
||||||
|
add_item(child)
|
||||||
|
|
||||||
|
add_item(item)
|
||||||
|
inform_changed_data(items_to_update)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
@detail_route(methods=['POST', 'PATCH', 'DELETE'])
|
@detail_route(methods=['POST', 'PATCH', 'DELETE'])
|
||||||
def manage_speaker(self, request, pk=None):
|
def manage_speaker(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user