I removed the model save/delete hooks for index updates since they were causing too much trouble with migrations

This commit is contained in:
Jonas Winkler
2020-11-08 11:24:57 +01:00
parent d31d45c2cf
commit ec1f65a355
5 changed files with 48 additions and 9 deletions

View File

@@ -99,6 +99,15 @@ class DocumentViewSet(RetrieveModelMixin,
ordering_fields = (
"id", "title", "correspondent__name", "document_type__name", "created", "modified", "added", "archive_serial_number")
def update(self, request, *args, **kwargs):
response = super(DocumentViewSet, self).update(request, *args, **kwargs)
index.add_or_update_document(self.get_object())
return response
def destroy(self, request, *args, **kwargs):
index.remove_document_from_index(self.get_object())
return super(DocumentViewSet, self).destroy(request, *args, **kwargs)
def file_response(self, pk, disposition):
#TODO: this should not be necessary here.
content_types = {