delete functionality for metadata

This commit is contained in:
Manuel Hude
2020-11-30 14:23:32 +01:00
parent 2e58c64ced
commit d7e2bf651b
3 changed files with 47 additions and 0 deletions
+18
View File
@@ -107,3 +107,21 @@ class ImageEndpoint:
return JsonResponse({'id': identifier, 'filename': filename},
safe=False) # 'metadata': metadata response beinhaltet ObjectId welche nicht serializable is?
@staticmethod
@api_view(['DELETE'])
def image_api_delete(request: HttpRequest, identifier):
logger.debug('Image DELETE single call: {}'.format(request))
instance = MongoManager.getInstance()
db = instance.AIC
col = db.metadata
try:
col.delete_one({"identifier": identifier})
except:
print("Could not delete Metadata")
return JsonResponse({'Result': 'success1'}, safe=False)