def del_items(request): user, item_name = read_request_item(request) item = is_owner(item=item_name, user=user) if item: item.delete() message = "Item {0} deleted".format(item_name) else: message= messages['CANNOT_PERFORM_ACTION'] return message
def del_items(request): user, item_name = read_request_item(request) item = is_owner(item=item_name, user=user) if item: item.delete() message = "Item {0} deleted".format(item_name) else: message = messages['CANNOT_PERFORM_ACTION'] return message
def update_items(request): user, item_name, doc = read_request_item(request) print "UP", type(doc) item = is_owner(item= item_name , user= user) if item: update_item(item= item, key_value=doc) message = messages['ITEM_UPDATED_MESSAGE'] else: message = messages['UNAUTHORISED_ACTION_MESSAGE'] return message
def update_items(request): user, item_name, doc = read_request_item(request) print "UP", type(doc) item = is_owner(item=item_name, user=user) if item: update_item(item=item, key_value=doc) message = messages['ITEM_UPDATED_MESSAGE'] else: message = messages['UNAUTHORISED_ACTION_MESSAGE'] return message