def delete_from_report(item_id, rep, user):
""" Delete an item
"""
try:
item = ReportItem.objects.get(id=item_id)
ReportItem.objects.filter(report=rep, rawItem=item.rawItem).delete()
report = Report.objects.get(id=rep)
if report.ticket:
database.log_action_on_ticket(
ticket=report.ticket,
action='delete_item',
user=user
)
return {'message': 'Item successfully removed'}
except (ObjectDoesNotExist, ValueError):
raise NotFound('Item not found')
评论列表
文章目录