def delete(self): if not DB.find_one("sinfo", {"name": self.name}): return 0 else: query_result = DB.delete(collection='sinfo', dcname={'name': self.name}) return (query_result.deleted_count)
def delete_product(product_code): if not app.config['DISABLE_TOKEN'] and not __check_authorization(): return jsonify({'error': 'Need a valid token.'}) deleted = DB.delete('products', {'product_code': product_code}) return Response(deleted, 200, mimetype='application/json')