Skip to content

Commit 3048141

Browse files
committed
Updates HTML
1 parent 6028869 commit 3048141

File tree

12 files changed

+86
-91
lines changed

12 files changed

+86
-91
lines changed

com/demo/dao/CustomerDao.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ def __init__(self):
66
self.mydb = mysql.connector.connect(
77
host="127.0.0.1",
88
user="root",
9-
password="bcmc1234",
9+
port=33061,
10+
password="Test@2020",
1011
database="employees"
1112
);
1213
self.mycursor = self.mydb.cursor();
1314

14-
def insertRecord(self,customer):
15+
def insertRecord(self, customer):
1516
try:
1617
mydb = self.mydb;
1718
mycursor = self.mycursor;
@@ -64,4 +65,9 @@ def createDatabase(self):
6465
self.mycursor.execute("Create database employees");
6566

6667
def createTable(self):
67-
self.c
68+
self.mycursor.execute("""create table if not exists employees.customers
69+
(
70+
name varchar(40) null,
71+
address varchar(200) null
72+
);
73+
""");

com/demo/models/Car.py renamed to com/demo/domain/Car.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#self and this are same. It can be anything but it should be first paramater in method
22

3-
from com.demo.models.Owner import Owner
3+
from com.demo.domain.Owner import Owner
44

55
class Car:
66
def __init__(self,make,model,color,year,owner):
File renamed without changes.
File renamed without changes.
File renamed without changes.

com/demo/web/CustomersController.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from com.demo.dao.CustomerDao import CustomerDao
88
# template folder location should be relevant to current file i.e. CustomersController.py
9-
from com.demo.models.Customer import Customer
9+
from com.demo.domain.Customer import Customer
1010

1111
app = Flask(__name__, template_folder='../../../templates');
1212
app.config.from_object(__name__);
@@ -20,10 +20,11 @@ class ReusableForm(Form):
2020

2121
@app.route("/")
2222
def home():
23-
return "Hello World";
23+
form = ReusableForm(request.form)
24+
return render_template("customers.html", form=form);
2425

2526

26-
@app.route("/showcustomers")
27+
@app.route("/show/customers")
2728
def getCustomers():
2829
customerDao = CustomerDao();
2930
return jsonify(customerDao.getCustomers());
@@ -33,7 +34,7 @@ def getCustomerPage():
3334
form = ReusableForm(request.form)
3435
return render_template("customers.html", form=form);
3536

36-
@app.route("/savecustomer",methods=['POST'])
37+
@app.route("/save",methods=['POST'])
3738
def saveCustomer():
3839
if request.method=='POST':
3940
name=request.form['name'];
@@ -49,7 +50,7 @@ def saveCustomer():
4950
def getHello():
5051
return render_template("hello.html");
5152

52-
@app.route("/createcustomer")
53+
@app.route("/create")
5354
def getSaveCustomerPage():
5455
form=ReusableForm(request.form)
5556
return render_template("createcustomer.html", form=form);

static/css/libraries/bootstrap-theme.min.css

Lines changed: 0 additions & 6 deletions
This file was deleted.

static/css/libraries/bootstrap.min.css

Lines changed: 0 additions & 6 deletions
This file was deleted.

static/js/libraries/bootstrap.min.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

static/js/libraries/jquery-3.3.1.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)