Beispiel #1
0
def insert_user(user_json):
  #print "INSERT USER"
  #print user_json
 
  user_string = json.loads(user_json)
  userAddress = Address(number = user_string["number"],
                    street = user_string["street"],
                    postalCode = user_string["postalCode"],
                    city = user_string["city"],
                    province = user_string["province"])

  #print "pizzaId: " + user_string["pizzaId"]
  
  userOrder = Order(qty = int(user_string["quantity"]),
								size = int(user_string["pizzaSize"]),
                pizza_type = int(user_string["pizzaId"]))   
  userAddress.put()
  userOrder.put()
  user = User(name = user_string["name"],
              phoneNumber = user_string["phoneNumber"],
              email = user_string["email"],
              addressId = userAddress.key(), 
              orderId = userOrder.key())  

  user.put()
  return user.key();