Exemple #1
0
    def post(self):
        title = self.get_argument("title", None)
        name = self.get_argument("name", None)
        age = self.get_argument("age", None)
        address = self.get_argument("address", None)
        phone = self.get_argument("phone", None)
        email = self.get_argument("email", None)
        type = self.get_argument("type", None)
        enable = self.get_argument("enable", None)

        customer = Customer(None)
        customer.title = title
        customer.name = name
        customer.age = age
        customer.address = address
        customer.phone = phone.split(",")
        customer.email = email
        customer_type = CustomerType(None)
        customer_type.key = type
        customer.type = customer_type
        customer.enable = enable

        customer_service.add(customer)

        self.set_header("Content-Type", "text/plain")
        self.write("成功")
Exemple #2
0
def test_add():
    customer = Customer(None)
    customer.title = "王先生"
    customer.phone = ["15652318567", "13126714247", "18599392408"]
    customer.name = "王光明"
    customer.age = 33
    customer.email = "*****@*****.**"
    customer.address = "中国北京"
    customer.type = CustomerType(None)
    customer.type.key = "1"
    customer.enable = True

    customer_id = customer_service.add(customer)
    print(customer_id)
Exemple #3
0
    def post(self):
        title = self.get_argument("title", None)
        name = self.get_argument("name", None)
        age = self.get_argument("age", None)
        phone = self.get_argument("phone", None)
        email = self.get_argument("email", None)
        address = self.get_argument("address", None)

        customer = Customer()
        customer.title = title
        customer.name = name
        customer.age = age
        customer.phone = phone
        customer.email = email
        customer.address = address

        customer.id = customer_service.max_id() + 1
        customer_service.add(customer)

        self.redirect("/customers")