Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Will labs #183

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1400f45
Responsive Design Notes
Nithfaris Mar 12, 2022
ed05931
Submitting Burrito Order Form Lab
Nithfaris Mar 16, 2022
30d6bc9
Submitting Company Page Lab
Nithfaris Mar 17, 2022
e1024d9
Flask Notes
Nithfaris Mar 18, 2022
9422fd2
Submitting Flask Redo Lab
Nithfaris Mar 19, 2022
648b0b2
Django Project 1 notes
Nithfaris Mar 23, 2022
16ad04b
Submit Django_Redo Lab and Django practice notes
Nithfaris Mar 25, 2022
5810889
model notes and slight changes to html for redo lab
Nithfaris Mar 26, 2022
673f7ba
Django notes and Django First Program lab
Nithfaris Mar 29, 2022
aea8eab
Django First App progress
Nithfaris Mar 30, 2022
f40c2b3
Grocery List Proj Progress
Nithfaris Mar 31, 2022
b5f616a
Small grocery app progress
Nithfaris Apr 1, 2022
576f338
Sessions Practice Lab
Nithfaris Apr 2, 2022
0bce763
Twitter Practice Project
Nithfaris Apr 7, 2022
cbb1821
Todo lab progress
Nithfaris Apr 8, 2022
bdec037
Todo App Progress
Nithfaris Apr 9, 2022
fa46967
twitter practice lab updates
Nithfaris Apr 12, 2022
82e3c3f
Grocery List proj and adding gitignore to projects
Nithfaris Apr 13, 2022
e04421f
Phonebook app practice
Nithfaris Apr 14, 2022
e22f2fd
Submit Todo Project
Nithfaris Apr 15, 2022
716b719
javascript intro notes
Nithfaris Apr 19, 2022
543dcf6
intro 2 notes
Nithfaris Apr 20, 2022
3dccf18
DOM notes and Js Redo start
Nithfaris Apr 21, 2022
00b9264
Js redo submission
Nithfaris Apr 22, 2022
8893642
Js ToDo List Lab progress
Nithfaris Apr 26, 2022
1f7d45d
API Notes and Todo List progress
Nithfaris Apr 27, 2022
ee2b2ad
todo list changes
Nithfaris Apr 28, 2022
4733abc
todo list app submission
Nithfaris Apr 29, 2022
cf3e53d
cards_api practice upload
Nithfaris May 4, 2022
42d07f8
Vue practice
Nithfaris May 11, 2022
d29af04
backend for vue todo app
Nithfaris May 12, 2022
29cbb6c
vue practice and vue_redo lab begun
Nithfaris May 13, 2022
8239d1b
vue redo lab progress
Nithfaris May 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Code/will/django_labs/django_redo/.gitignore
Binary file not shown.
Empty file.
16 changes: 16 additions & 0 deletions Code/will/django_labs/django_redo/django_redo/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for django_redo 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', 'django_redo.settings')

application = get_asgi_application()
126 changes: 126 additions & 0 deletions Code/will/django_labs/django_redo/django_redo/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
"""
Django settings for django_redo 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 decouple import config
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/

SECRET_KEY = config("SECRET_KEY")

# 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',

# project apps
'redoapp'
]

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 = 'django_redo.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 = 'django_redo.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/Chicago'

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'
22 changes: 22 additions & 0 deletions Code/will/django_labs/django_redo/django_redo/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""django_redo 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('unitcon/', include('redoapp.urls'))
]
16 changes: 16 additions & 0 deletions Code/will/django_labs/django_redo/django_redo/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for django_redo 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', 'django_redo.settings')

application = get_wsgi_application()
22 changes: 22 additions & 0 deletions Code/will/django_labs/django_redo/manage.py
Original file line number Diff line number Diff line change
@@ -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', 'django_redo.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()
Empty file.
3 changes: 3 additions & 0 deletions Code/will/django_labs/django_redo/redoapp/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions Code/will/django_labs/django_redo/redoapp/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class RedoappConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'redoapp'
Empty file.
3 changes: 3 additions & 0 deletions Code/will/django_labs/django_redo/redoapp/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unit Conversion Results</title>
</head>
<body>
<h1>Results:</h1>


<h3>{{distance_to_convert}} {{units_to_convert}} is equal to {{converted_units}} {{meters_to_units}}</h3>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unit Converter</title>
</head>
<body>
<h1>Unit Converting</h1>
<h3>This converter can convert feet, miles, meters, kilometers, yards, and inches.</h3>


<form action="{% url 'redoapp:result' %}" method="post">
{% csrf_token %}
<label for="convert">Units to convert:</label>
<input type="text" name="convert" required>

<label for="amount">The amount of units:</label>
<input type="text" name="amount" required>

<label for="converted">Units to convert into:</label>
<input type="text" name="converted" required>

<button type="submit">Convert</button>
</form>
</body>
</html>
3 changes: 3 additions & 0 deletions Code/will/django_labs/django_redo/redoapp/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
10 changes: 10 additions & 0 deletions Code/will/django_labs/django_redo/redoapp/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.urls import path
from . import views

app_name = 'redoapp'
urlpatterns = [
path('', views.unitcon, name='unitcon'),

path('result/', views.result, name='result')

]
33 changes: 33 additions & 0 deletions Code/will/django_labs/django_redo/redoapp/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from http.client import HTTPResponse
from django.shortcuts import render
from django.http import HttpResponse

# Create your views here.


def unitcon(request):
return render(request, 'redoapp/unitcon.html')


def result(request):
conversion = request.POST

units_to_convert = conversion['convert']
distance_to_convert = conversion['amount']
meters_to_units = conversion['converted']
distance_to_convert = int(distance_to_convert)

distances = {'feet': 0.3048, 'miles': 1609.34, 'meters': 1.0,
'kilometers': 1000, 'yards': 0.9144, 'inches': 0.0254}
# convert the meters into the desired second unit and print results
units_to_meters = distance_to_convert * distances.get(units_to_convert)
converted_units = units_to_meters / distances.get(meters_to_units)
converted_units = round(converted_units, 3)

context = {'converted_units': converted_units,
'meters_to_units': meters_to_units,
'units_to_convert': units_to_convert,
'distance_to_convert': distance_to_convert
}

return render(request, 'redoapp/result.html', context)
1 change: 1 addition & 0 deletions Code/will/django_labs/grocery_list_proj/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
Empty file.
16 changes: 16 additions & 0 deletions Code/will/django_labs/grocery_list_proj/grocery_list_proj/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for grocery_list_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', 'grocery_list_proj.settings')

application = get_asgi_application()
Loading