Skip to content

Commit

Permalink
Concept/Mapping | hard delete support
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Apr 13, 2021
1 parent 35412d4 commit 72b143b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/concepts/views.py
Expand Up @@ -180,6 +180,11 @@ def update(self, request, *args, **kwargs):
def destroy(self, request, *args, **kwargs):
concept = self.get_object()
comment = request.data.get('update_comment', None) or request.data.get('comment', None)
hard_delete = request.query_params.get('hardDelete', None) in ['true', True, 'True']
if hard_delete:
concept.delete()
return Response(status=status.HTTP_204_NO_CONTENT)

errors = concept.retire(request.user, comment)

if errors:
Expand Down
5 changes: 5 additions & 0 deletions core/mappings/views.py
Expand Up @@ -149,6 +149,11 @@ def update(self, request, *args, **kwargs):
def destroy(self, request, *args, **kwargs):
mapping = self.get_object()
comment = request.data.get('update_comment', None) or request.data.get('comment', None)
hard_delete = request.query_params.get('hardDelete', None) in ['true', True, 'True']
if hard_delete:
mapping.delete()
return Response(status=status.HTTP_204_NO_CONTENT)

errors = mapping.retire(request.user, comment)

if errors:
Expand Down

0 comments on commit 72b143b

Please sign in to comment.