diff --git a/Code/matthew/django/labs/01_django_redo/manage.py b/Code/matthew/django/labs/01_django_redo/manage.py
new file mode 100755
index 00000000..707d435e
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+ """Run administrative tasks."""
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'unit_converter_proj.settings')
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError as exc:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ ) from exc
+ execute_from_command_line(sys.argv)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_app/__init__.py b/Code/matthew/django/labs/01_django_redo/unit_converter_app/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_app/admin.py b/Code/matthew/django/labs/01_django_redo/unit_converter_app/admin.py
new file mode 100644
index 00000000..8c38f3f3
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_app/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_app/apps.py b/Code/matthew/django/labs/01_django_redo/unit_converter_app/apps.py
new file mode 100644
index 00000000..7f259c7f
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_app/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class UnitConverterAppConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'unit_converter_app'
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_app/migrations/__init__.py b/Code/matthew/django/labs/01_django_redo/unit_converter_app/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_app/models.py b/Code/matthew/django/labs/01_django_redo/unit_converter_app/models.py
new file mode 100644
index 00000000..71a83623
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_app/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_app/templates/unit_converter_app/index.html b/Code/matthew/django/labs/01_django_redo/unit_converter_app/templates/unit_converter_app/index.html
new file mode 100644
index 00000000..0cd2bdcf
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_app/templates/unit_converter_app/index.html
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+ Unit Converter
+
+
+ Unit Converter
+ {% comment %}
+ try action=" {% url APP_NAME:result %}"
+ action="ucp/result/"
+ {% endcomment %}
+
+
+
+
+
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_app/templates/unit_converter_app/result.html b/Code/matthew/django/labs/01_django_redo/unit_converter_app/templates/unit_converter_app/result.html
new file mode 100644
index 00000000..6d3624c2
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_app/templates/unit_converter_app/result.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ Results
+
+
+ Results
+
+
+ You converted {{distance}}{{units}} into
+ {{converted_output}}{{units_to_convert}}
+
+ Reset
+
+
+
+ distance {{ distance }} units {{units}} converted units {{converted_output}}
+ units to convert {{units_to_convert}}
+
+
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_app/tests.py b/Code/matthew/django/labs/01_django_redo/unit_converter_app/tests.py
new file mode 100644
index 00000000..7ce503c2
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_app/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_app/urls.py b/Code/matthew/django/labs/01_django_redo/unit_converter_app/urls.py
new file mode 100644
index 00000000..95ab0ccd
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_app/urls.py
@@ -0,0 +1,18 @@
+from django.urls import path, include
+from . import views
+# . :importing the views from the views file in the same directory
+
+#
+app_name = 'unitconverter'
+
+urlpatterns = [
+ # 8000/ucp
+ path('', views.index, name='index'),
+
+
+ path('result/', views.forms, name='forms')
+
+ # 8000/rps/result
+ # path('result/', views.result, name='result'),
+
+]
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_app/views.py b/Code/matthew/django/labs/01_django_redo/unit_converter_app/views.py
new file mode 100644
index 00000000..d740b123
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_app/views.py
@@ -0,0 +1,101 @@
+
+from django.shortcuts import render
+
+# Create your views here.
+
+
+def index(request):
+
+ return render(request, 'unit_converter_app/index.html')
+
+
+# request.POST is grabbing the information inside of the from submission
+def forms(request):
+ form_post = request.POST
+
+ #EXAMPLE: distance=form_post['distance']
+
+ distance = form_post['distance']
+ units = form_post['user_units']
+ units_to_convert = form_post['conversion_units']
+
+ def feet_to_meters(x):
+ converted_ft = float(x) * .3048
+ return converted_ft
+
+ def mile_to_meters(x):
+ converted_mi = float(x) * 1609.34
+ return converted_mi
+
+ def km_to_meters(x):
+ converted_km = float(x) * 1000
+ return converted_km
+
+ def meters_to_feet(x):
+ converted_ft = float(x) * 3.28084
+ return converted_ft
+
+ def meters_to_mile(x):
+ converted_mi = float(x) * .000621371
+ return converted_mi
+
+ def meters_to_km(x):
+ converted_km = float(x) * .001
+ return converted_km
+
+ if units.lower() == 'mi' and units_to_convert.lower() == 'km':
+ converted_output = meters_to_km(mile_to_meters(distance))
+ print(f'\n {distance}mi is {converted_output}km')
+
+ elif units.lower() == 'mi' and units_to_convert.lower() == 'm':
+ converted_output = mile_to_meters(distance)
+ print(f'\n {distance}mi is {converted_output}m')
+
+ elif units.lower() == 'mi' and units_to_convert.lower() == 'ft':
+ converted_output = meters_to_feet(mile_to_meters(distance))
+ print(f'\n {distance}mi is {converted_output}ft')
+
+ elif units.lower() == 'km' and units_to_convert.lower() == 'mi':
+ converted_output = meters_to_mile(km_to_meters(distance))
+ print(f'\n {distance}km is {converted_output}mi')
+
+ elif units.lower() == 'km' and units_to_convert.lower() == 'm':
+ converted_output = km_to_meters(distance)
+ print(f'\n {distance}km is {converted_output}m')
+
+ elif units.lower() == 'km' and units_to_convert.lower() == 'ft':
+ converted_output = meters_to_feet(km_to_meters(distance))
+ print(f'\n {distance}km is {converted_output}ft')
+
+ elif units.lower() == 'ft' and units_to_convert.lower() == 'mi':
+ converted_output = mile_to_meters(feet_to_meters(distance))
+ print(f'\n {distance}ft is {converted_output}mi')
+
+ elif units.lower() == 'ft' and units_to_convert.lower() == 'm':
+ converted_output = feet_to_meters(distance)
+ print(f'\n {distance}ft is {converted_output}m')
+
+ elif units.lower() == 'ft' and units_to_convert.lower() == 'km':
+ converted_output = meters_to_km(feet_to_meters(distance))
+ print(f'\n {distance}mi is {converted_output}ft')
+
+ elif units.lower() == 'm' and units_to_convert.lower() == 'ft':
+ converted_output = meters_to_feet(distance)
+ print(f'\n {distance}km is {converted_output}ft')
+
+ elif units.lower() == 'm' and units_to_convert.lower() == 'mi':
+ converted_output = meters_to_mile(distance)
+ print(f'\n {distance}ft is {converted_output}mi')
+
+ elif units.lower() == 'm' and units_to_convert.lower() == 'km':
+ converted_output = meters_to_km
+ print(f'\n {distance}mi is {converted_output}ft')
+
+ context = {
+ 'distance': distance,
+ 'converted_output': converted_output,
+ 'units': units,
+ 'units_to_convert': units_to_convert,
+ }
+
+ return render(request, 'unit_converter_app/result.html', context)
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_proj/__init__.py b/Code/matthew/django/labs/01_django_redo/unit_converter_proj/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_proj/asgi.py b/Code/matthew/django/labs/01_django_redo/unit_converter_proj/asgi.py
new file mode 100644
index 00000000..6c082a5d
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_proj/asgi.py
@@ -0,0 +1,16 @@
+"""
+ASGI config for unit_converter_proj project.
+
+It exposes the ASGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'unit_converter_proj.settings')
+
+application = get_asgi_application()
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_proj/settings.py b/Code/matthew/django/labs/01_django_redo/unit_converter_proj/settings.py
new file mode 100644
index 00000000..17368170
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_proj/settings.py
@@ -0,0 +1,124 @@
+"""
+Django settings for unit_converter_proj project.
+
+Generated by 'django-admin startproject' using Django 4.0.3.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/4.0/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/4.0/ref/settings/
+"""
+
+from pathlib import Path
+
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
+BASE_DIR = Path(__file__).resolve().parent.parent
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'django-insecure-29itg#5d48)-=q32_h*d159m_29+t!)o#ka4px32c6=58((!8s'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ 'unit_converter_app'
+]
+
+MIDDLEWARE = [
+ 'django.middleware.security.SecurityMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'unit_converter_proj.urls'
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = 'unit_converter_proj.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': BASE_DIR / 'db.sqlite3',
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+ },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/4.0/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/4.0/howto/static-files/
+
+STATIC_URL = 'static/'
+
+# Default primary key field type
+# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
+
+DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_proj/urls.py b/Code/matthew/django/labs/01_django_redo/unit_converter_proj/urls.py
new file mode 100644
index 00000000..73b7c499
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_proj/urls.py
@@ -0,0 +1,22 @@
+"""unit_converter_proj URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/4.0/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.urls import include, path
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import path, include
+
+urlpatterns = [
+ path('admin/', admin.site.urls),
+ path('ucp/', include('unit_converter_app.urls'))
+]
diff --git a/Code/matthew/django/labs/01_django_redo/unit_converter_proj/wsgi.py b/Code/matthew/django/labs/01_django_redo/unit_converter_proj/wsgi.py
new file mode 100644
index 00000000..4eaa5183
--- /dev/null
+++ b/Code/matthew/django/labs/01_django_redo/unit_converter_proj/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for unit_converter_proj project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'unit_converter_proj.settings')
+
+application = get_wsgi_application()
diff --git a/Code/matthew/django/labs/02_first_app/manage.py b/Code/matthew/django/labs/02_first_app/manage.py
new file mode 100755
index 00000000..a7da6671
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+ """Run administrative tasks."""
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError as exc:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ ) from exc
+ execute_from_command_line(sys.argv)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/Code/matthew/django/labs/02_first_app/mysite/__init__.py b/Code/matthew/django/labs/02_first_app/mysite/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/Code/matthew/django/labs/02_first_app/mysite/asgi.py b/Code/matthew/django/labs/02_first_app/mysite/asgi.py
new file mode 100644
index 00000000..674a5a5a
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/mysite/asgi.py
@@ -0,0 +1,16 @@
+"""
+ASGI config for mysite project.
+
+It exposes the ASGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
+
+application = get_asgi_application()
diff --git a/Code/matthew/django/labs/02_first_app/mysite/settings.py b/Code/matthew/django/labs/02_first_app/mysite/settings.py
new file mode 100644
index 00000000..624c5cc7
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/mysite/settings.py
@@ -0,0 +1,126 @@
+"""
+Django settings for mysite project.
+
+Generated by 'django-admin startproject' using Django 4.0.3.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/4.0/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/4.0/ref/settings/
+"""
+
+from pathlib import Path
+
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
+BASE_DIR = Path(__file__).resolve().parent.parent
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'django-insecure-fefz2h=hzcahf+b-ogytoq8a7q*h)v#c&%9tiesm4eiobw=fpo'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ #
+ 'polls.apps.PollsConfig',
+
+]
+
+MIDDLEWARE = [
+ 'django.middleware.security.SecurityMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'mysite.urls'
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = 'mysite.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': BASE_DIR / 'db.sqlite3',
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+ },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/4.0/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'America/Los_Angeles'
+
+USE_I18N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/4.0/howto/static-files/
+
+STATIC_URL = 'static/'
+
+# Default primary key field type
+# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
+
+DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
diff --git a/Code/matthew/django/labs/02_first_app/mysite/urls.py b/Code/matthew/django/labs/02_first_app/mysite/urls.py
new file mode 100644
index 00000000..9f69e0ae
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/mysite/urls.py
@@ -0,0 +1,23 @@
+"""mysite URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/4.0/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.urls import include, path
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import path, include
+
+urlpatterns = [
+ path('admin/', admin.site.urls),
+
+ path('index/', include('polls.urls'))
+]
diff --git a/Code/matthew/django/labs/02_first_app/mysite/wsgi.py b/Code/matthew/django/labs/02_first_app/mysite/wsgi.py
new file mode 100644
index 00000000..48d46fe4
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/mysite/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for mysite project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
+
+application = get_wsgi_application()
diff --git a/Code/matthew/django/labs/02_first_app/polls/__init__.py b/Code/matthew/django/labs/02_first_app/polls/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/Code/matthew/django/labs/02_first_app/polls/admin.py b/Code/matthew/django/labs/02_first_app/polls/admin.py
new file mode 100644
index 00000000..d3ee231f
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/polls/admin.py
@@ -0,0 +1,5 @@
+from django.contrib import admin
+from .models import Question
+# Register your models here.
+
+admin.site.register(Question)
diff --git a/Code/matthew/django/labs/02_first_app/polls/apps.py b/Code/matthew/django/labs/02_first_app/polls/apps.py
new file mode 100644
index 00000000..5a5f94ca
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/polls/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class PollsConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'polls'
diff --git a/Code/matthew/django/labs/02_first_app/polls/migrations/0001_initial.py b/Code/matthew/django/labs/02_first_app/polls/migrations/0001_initial.py
new file mode 100644
index 00000000..21b4e6d9
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/polls/migrations/0001_initial.py
@@ -0,0 +1,32 @@
+# Generated by Django 4.0.3 on 2022-03-29 03:09
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Question',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('question_text', models.CharField(max_length=200)),
+ ('pub_date', models.DateTimeField(verbose_name='date published')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Choice',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('choice_text', models.CharField(max_length=200)),
+ ('votes', models.IntegerField(default=0)),
+ ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='polls.question')),
+ ],
+ ),
+ ]
diff --git a/Code/matthew/django/labs/02_first_app/polls/migrations/__init__.py b/Code/matthew/django/labs/02_first_app/polls/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/Code/matthew/django/labs/02_first_app/polls/models.py b/Code/matthew/django/labs/02_first_app/polls/models.py
new file mode 100644
index 00000000..05ae0a2e
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/polls/models.py
@@ -0,0 +1,25 @@
+import datetime
+from django.utils import timezone
+from django.db import models
+
+# Create your models here.
+
+
+class Question(models.Model):
+ question_text = models.CharField(max_length=200)
+ pub_date = models.DateTimeField('date published')
+
+ def __str__(self):
+ return self.question_text
+
+ def was_published_recently(self):
+ return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
+
+
+class Choice(models.Model):
+ question = models.ForeignKey(Question, on_delete=models.CASCADE)
+ choice_text = models.CharField(max_length=200)
+ votes = models.IntegerField(default=0)
+
+ def __str__(self):
+ return self.choice_text
diff --git a/Code/matthew/django/labs/02_first_app/polls/templates/polls/index.html b/Code/matthew/django/labs/02_first_app/polls/templates/polls/index.html
new file mode 100644
index 00000000..0bbc0af3
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/polls/templates/polls/index.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ Document
+
+
+ {% if latest_question_list %}
+
+ {% else %}
+ No polls are Avaliable.
+ {% endif %}
+
+
diff --git a/Code/matthew/django/labs/02_first_app/polls/tests.py b/Code/matthew/django/labs/02_first_app/polls/tests.py
new file mode 100644
index 00000000..7ce503c2
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/polls/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/Code/matthew/django/labs/02_first_app/polls/urls.py b/Code/matthew/django/labs/02_first_app/polls/urls.py
new file mode 100644
index 00000000..9c4372fe
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/polls/urls.py
@@ -0,0 +1,28 @@
+"""mysite URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/4.0/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.urls import include, path
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
+"""
+from . import views
+from django.urls import path
+
+urlpatterns = [
+ # ex: /polls/
+ path('', views.index, name='index'),
+ # ex: /polls/5/
+ path('/', views.detail, name='detail'),
+ # ex: /polls/5/results/
+ path('/results/', views.results, name='results'),
+ # ex: /polls/5/vote/
+ path('/vote/', views.vote, name='vote'),
+]
diff --git a/Code/matthew/django/labs/02_first_app/polls/views.py b/Code/matthew/django/labs/02_first_app/polls/views.py
new file mode 100644
index 00000000..f6e453e1
--- /dev/null
+++ b/Code/matthew/django/labs/02_first_app/polls/views.py
@@ -0,0 +1,31 @@
+
+from django.shortcuts import render
+from django.template import loader
+# from django.shortcuts import render
+from django.http import HttpResponse
+from .models import Question
+
+# Create your views here.
+
+
+def index(request):
+ latest_question_list = Question.objects.order_by('-pub_date')[:5]
+ # template = loader.get_template('polls/index.html')
+ context = {
+ 'latest_question_list': latest_question_list,
+ }
+ # return HttpResponse(template.render(context, request))
+ return render(request, 'polls/index.html', context)
+
+
+def detail(request, question_id):
+ return HttpResponse("You're looking at question %s." % question_id)
+
+
+def results(request, question_id):
+ response = "You're looking at the results of question %s."
+ return HttpResponse(response % question_id)
+
+
+def vote(request, question_id):
+ return HttpResponse("You're voting on question %s." % question_id)
diff --git a/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/__init__.py b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/admin.py b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/admin.py
new file mode 100644
index 00000000..64a74eba
--- /dev/null
+++ b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/admin.py
@@ -0,0 +1,6 @@
+from django.contrib import admin
+from . models import List
+
+# Register your models here.
+
+admin.site.register(List)
\ No newline at end of file
diff --git a/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/apps.py b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/apps.py
new file mode 100644
index 00000000..87b0bfcb
--- /dev/null
+++ b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class GroceryAppConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'grocery_app'
diff --git a/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/migrations/0001_initial.py b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/migrations/0001_initial.py
new file mode 100644
index 00000000..b53f41f1
--- /dev/null
+++ b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/migrations/0001_initial.py
@@ -0,0 +1,27 @@
+# Generated by Django 4.0.3 on 2022-04-04 19:37
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='List',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('new', models.CharField(max_length=50)),
+ ('date', models.DateField(auto_now=True)),
+ ('delete', models.BooleanField(default=False)),
+ ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ],
+ ),
+ ]
diff --git a/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/migrations/__init__.py b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/models.py b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/models.py
new file mode 100644
index 00000000..e8c21245
--- /dev/null
+++ b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/models.py
@@ -0,0 +1,13 @@
+from django.db import models
+from django.contrib.auth.models import User
+# Create your models here.
+
+class List(models.Model):
+ new= models.CharField(max_length=50)
+ date= models.DateField(auto_now=True)
+ user= models.ForeignKey(User, on_delete=models.CASCADE)
+ delete= models.BooleanField(default=False)
+
+ def __str__(self):
+ return f'{self.new}: {self.date}'
+
diff --git a/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/templates/grocery_app/edit.html b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/templates/grocery_app/edit.html
new file mode 100644
index 00000000..225e9c39
--- /dev/null
+++ b/Code/matthew/django/labs/03_grocery_list/grocery_list/grocery_app/templates/grocery_app/edit.html
@@ -0,0 +1,9 @@
+{% extends "grocery_app/index.html" %}
+{% load static %}
+
+ {% block content %}
+ Edit
+ {{item}}
+ {% endblock content %}
+
+