예제 #1
0
def creat():
    if request.method == "GET":
        return render_template('new-service.html')
    elif request.method == "POST":
        form = request.form
        name = form['name']
        job = form['job']
        phone = form['phone']
        new_service = Customer(name=name, job=job, phone=phone)
        new_service.save()

        return redirect(url_for('admin'))
def search_customer():
    all_customer = Customer.objects(gender=1, contacted=False)
    if len(all_customer) < 10:
        all_customer = all_customer
    else:
        all_customer = all_customer[0:10]

    return render_template('customer.html', all_customer=all_customer)
예제 #3
0
import mlab
from faker import Faker
from random import randint, choice

mlab.connect()

fake = Faker()
# for i in range(50):
#     print("Saving service", i+1,"......")
#     new_service = Service(
#         name = fake.name(),
#         yob = randint(1990, 2000),
#         gender = randint(0,1),
#         height = randint(150, 190),
#         phone = fake.phone_number(),
#         address = fake.address(),
#         status = choice([True, False])
#     )
#     new_service.save()

for i in range(50):
    print("Saving customer", i + 1, "......")
    new_customer = Customer(name=fake.name(),
                            gender=randint(0, 1),
                            email=fake.email(),
                            phone=fake.phone_number(),
                            job=fake.job(),
                            company=fake.company(),
                            contacted=choice([True, False]))
    new_customer.save()
def customer():
    all_customer = Customer.objects()
    return render_template("customer.html", all_customer=all_customer)
예제 #5
0
def customer():
    #Render all customers: (bỏ cmt để kiểm tra a eii :v)
    all_customers = Customer.objects()
    return render_template('customer.html', all_customers=all_customers)
예제 #6
0
from models.service import Customer
import mlab
from faker import Faker
from random import randint, choice

mlab.connect()

fake = Faker()
# print (fake.address())
for i in range (50):
    print ("Saving Service", i+1, "......")
    new_service = Customer(
        name = fake.name(),
        job = fake.job(),
        gender = randint (0,1),
        phone = fake.phone_number(),
        company = fake.company(),
        status = choice[(True, False)]
        
    )
    new_service.save()
예제 #7
0
from models.service import Customer
import mlab

mlab.connect()

all_info = Customer.objects()
예제 #8
0
from models.service import Service, Customer
import mlab

mlab.connect()

all_service = Service.objects()
all_customer = Customer.objects()

# print(all_customer[0]["id"])

Customer.objects(id="5b5f1527d7aadc29a4369fd1").delete()
예제 #9
0
def admin():
    all_service = Customer.objects()
    return render_template('admin.html', all_service=all_service)
예제 #10
0
def firstmale():
    all_customer = Customer.objects(gender=1)
    search = all_customer[0:10]
    return render_template('topman.html', search=search)
예제 #11
0
def customer():
    all_customer = Customer.objects()
    return render_template('info.html', all_customer=all_customer)
예제 #12
0
from models.service import Service, Customer
from mlab

mlab.connect()

all_service = Service.objects()
all_customer = Customer.objects()