Merge pull request #4369 from normanjaeckel/HistoryForMotionChangeRecommendations

Added history information for motion change recommendations.
This commit is contained in:
Emanuel Schütze 2019-02-19 17:26:31 +01:00 committed by GitHub
commit 8ab66418ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1059,6 +1059,47 @@ class MotionChangeRecommendationViewSet(ModelViewSet):
except DjangoValidationError as err:
return Response({"detail": err.message}, status=400)
def perform_create(self, serializer):
"""
Customized method to add history information.
"""
instance = serializer.save()
# Fire autoupdate again to save information to OpenSlides history.
inform_changed_data(
instance,
information=["Motion change recommendation created"],
user_id=self.request.user.pk,
)
def perform_update(self, serializer):
"""
Customized method to add history information.
"""
instance = serializer.save()
# Fire autoupdate again to save information to OpenSlides history.
inform_changed_data(
instance,
information=["Motion change recommendation updated"],
user_id=self.request.user.pk,
)
def destroy(self, request, *args, **kwargs):
"""
Customized method to add history information.
"""
instance = self.get_object()
result = super().destroy(request, *args, **kwargs)
# Fire autoupdate again to save information to OpenSlides history.
inform_deleted_data(
[(instance.get_collection_string(), instance.pk)],
information=["Motion change recommendation deleted"],
user_id=request.user.pk,
)
return result
class MotionCommentSectionViewSet(ModelViewSet):
"""