def step_2(context): for row in context.table: try: context.customer_id = Customer.get( Customer.email == '*****@*****.**') except Customer.DoesNotExist: context.customer_id = Customer.create(email='*****@*****.**') context.order_id = Order.create(customer_id=context.customer_id, order_status=row['order_status'], district=row['district'])
def post(self): parser = reqparse.RequestParser() args = self.reqparse.parse_args() # with DB.atomic(): customer = Customer.create(**args) return {'isSuccess': True, 'customer_id': customer.customer_id}