def tag_remove(request): tag = request.matchdict["tag"] error_id = request.matchdict["id"] project = get_selected_project(request) try: error = Error.objects(project=project.token, id=error_id).get() if tag not in error.tags: return {"type": "failure"} error.tags.remove(tag) error.save() Tag.removeOne(tag) return {"type": "success"} except: return {"type": "failure"}
def tag_add(request): tag = request.matchdict["tag"] error_id = request.matchdict["id"] project = get_selected_project(request) try: error = Error.objects(project=project.token, id=error_id).get() if tag in error.tags: return {"type": "failure"} error.tags.append(tag) error.save() Tag.create(tag).save() return {"type": "success"} except: return {"type": "failure"}