From ab35b8760f05920ce72091407d917242168e754b Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Wed, 19 Jan 2022 15:18:44 -0600 Subject: [PATCH 1/2] saving copy-pasta code from course --- models/__init__.py | 1 + models/animal.py | 14 ++++++++++++++ models/customer.py | 0 models/employee.py | 0 models/location.py | 5 +++++ 5 files changed, 20 insertions(+) create mode 100644 models/__init__.py create mode 100644 models/animal.py create mode 100644 models/customer.py create mode 100644 models/employee.py create mode 100644 models/location.py diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..65f1396 --- /dev/null +++ b/models/__init__.py @@ -0,0 +1 @@ +from .animal import Animal \ No newline at end of file diff --git a/models/animal.py b/models/animal.py new file mode 100644 index 0000000..a7ad998 --- /dev/null +++ b/models/animal.py @@ -0,0 +1,14 @@ +class Animal(): + + # Class initializer. It has 5 custom parameters, with the + # special `self` parameter that every method on a class + # needs as the first parameter. + def __init__(self, id, name, breed, status, location_id, customer_id): + self.id = id + self.name = name + self.breed = breed + self.status = status + self.location_id = location_id + self.customer_id = customer_id + + new_animal = Animal(1, "Snickers", "Dog", "Recreation", 1, 4) \ No newline at end of file diff --git a/models/customer.py b/models/customer.py new file mode 100644 index 0000000..e69de29 diff --git a/models/employee.py b/models/employee.py new file mode 100644 index 0000000..e69de29 diff --git a/models/location.py b/models/location.py new file mode 100644 index 0000000..b0a82c9 --- /dev/null +++ b/models/location.py @@ -0,0 +1,5 @@ +class Location(): + + def __init__(self, id, address): + self.id = id + self.address = address \ No newline at end of file From 660ae454ecc561075ee6d27b1abc263ec87212b7 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Thu, 20 Jan 2022 10:11:40 -0600 Subject: [PATCH 2/2] completed chapter 7 --- models/__init__.py | 5 ++++- models/animal.py | 2 +- models/customer.py | 6 ++++++ models/employee.py | 6 ++++++ models/location.py | 9 +++++++-- views/customer_requests.py | 8 +------- views/location_requests.py | 6 ++++-- 7 files changed, 29 insertions(+), 13 deletions(-) diff --git a/models/__init__.py b/models/__init__.py index 65f1396..8324d68 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -1 +1,4 @@ -from .animal import Animal \ No newline at end of file +from .animal import Animal +from .customer import Customer +from .employee import Employee +from .location import Location \ No newline at end of file diff --git a/models/animal.py b/models/animal.py index a7ad998..b2a49d1 100644 --- a/models/animal.py +++ b/models/animal.py @@ -11,4 +11,4 @@ class Animal(): self.location_id = location_id self.customer_id = customer_id - new_animal = Animal(1, "Snickers", "Dog", "Recreation", 1, 4) \ No newline at end of file + # new_animal = Animal(1, "Snickers", "Dog", "Recreation", 1, 4) \ No newline at end of file diff --git a/models/customer.py b/models/customer.py index e69de29..854aaaa 100644 --- a/models/customer.py +++ b/models/customer.py @@ -0,0 +1,6 @@ +class Customer(): + '''Factory class for customer objects''' + def __init__(self, id, name, email) -> None: + self.id = id + self.name = name + self.email = email \ No newline at end of file diff --git a/models/employee.py b/models/employee.py index e69de29..db1256e 100644 --- a/models/employee.py +++ b/models/employee.py @@ -0,0 +1,6 @@ +class Employee(): + + def __init__(self, id, name, email): + self.id = id + self.name = name + self.email = email \ No newline at end of file diff --git a/models/location.py b/models/location.py index b0a82c9..bcd6b8e 100644 --- a/models/location.py +++ b/models/location.py @@ -1,5 +1,10 @@ class Location(): - def __init__(self, id, address): + def __init__(self, id, name, address): self.id = id - self.address = address \ No newline at end of file + self.name = name + self.address = address + + #"id": 1, + #"name": "Nashville North", + #"address": "389 Deumbrion Street, Nashville, TN, 37909" \ No newline at end of file diff --git a/views/customer_requests.py b/views/customer_requests.py index d1566be..905010f 100644 --- a/views/customer_requests.py +++ b/views/customer_requests.py @@ -3,42 +3,36 @@ CUSTOMERS = [ "id": 1, "name": "Ryan Tanay", "email": "ryan@tanay.com", - "employee": False }, { "id": 2, "name": "Emma Beaton", "email": "emma@beaton.com", - "employee": False + }, { "id": 3, "name": "Dani Adkins", "email": "dani.adkins.com", - "employee": False }, { "id": 4, "name": "Adam Oswalt", "email": "adam@oswalt.com", - "employee": False }, { "id": 5, "name": "Fletcher Bangs", "email": "flangs@bangs.com", - "employee": False }, { "id": 6, "name": "Angela Lee", "email": "lee@lee.com", - "employee": False }, { "name": "mike mike", "email": "m@m.com", - "employee": False, "id": 7 }, diff --git a/views/location_requests.py b/views/location_requests.py index 04c3730..1efbf2e 100644 --- a/views/location_requests.py +++ b/views/location_requests.py @@ -1,11 +1,13 @@ LOCATIONS = [ { "id": 1, - "name": "Nashville North" + "name": "Nashville North", + "address": "389 Deumbrion Street, Nashville, TN, 37909" }, { "id": 2, - "name": "Nashville South" + "name": "Nashville South", + "address":"1783 Thompson Lane, Nashville, TN, 37867" } , ]