diff --git a/Code/nestor/Password_Generator/Password_Generator/__init__.py b/Code/nestor/Password_Generator/Password_Generator/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/nestor/Password_Generator/Password_Generator/asgi.py b/Code/nestor/Password_Generator/Password_Generator/asgi.py new file mode 100644 index 00000000..4e8bf2fd --- /dev/null +++ b/Code/nestor/Password_Generator/Password_Generator/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for Password_Generator 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', 'Password_Generator.settings') + +application = get_asgi_application() diff --git a/Code/nestor/Password_Generator/Password_Generator/settings.py b/Code/nestor/Password_Generator/Password_Generator/settings.py new file mode 100644 index 00000000..cfebac17 --- /dev/null +++ b/Code/nestor/Password_Generator/Password_Generator/settings.py @@ -0,0 +1,126 @@ +""" +Django settings for Password_Generator 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-li311$%m*@(9$$v&abk(4!xuo)galip4!h25s)le35q6uo=0va' + +# 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', + + 'Password_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 = 'Password_Generator.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 = 'Password_Generator.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/' +STATICFILES_DIRS = [str(BASE_DIR.joinpath('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/nestor/Password_Generator/Password_Generator/urls.py b/Code/nestor/Password_Generator/Password_Generator/urls.py new file mode 100644 index 00000000..a0f851f6 --- /dev/null +++ b/Code/nestor/Password_Generator/Password_Generator/urls.py @@ -0,0 +1,22 @@ +"""Password_Generator 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('Password_app/', include('Password_app.urls')) +] diff --git a/Code/nestor/Password_Generator/Password_Generator/wsgi.py b/Code/nestor/Password_Generator/Password_Generator/wsgi.py new file mode 100644 index 00000000..ca9af523 --- /dev/null +++ b/Code/nestor/Password_Generator/Password_Generator/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for Password_Generator 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', 'Password_Generator.settings') + +application = get_wsgi_application() diff --git a/Code/nestor/Password_Generator/Password_app/__init__.py b/Code/nestor/Password_Generator/Password_app/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/nestor/Password_Generator/Password_app/admin.py b/Code/nestor/Password_Generator/Password_app/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/Code/nestor/Password_Generator/Password_app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/Code/nestor/Password_Generator/Password_app/apps.py b/Code/nestor/Password_Generator/Password_app/apps.py new file mode 100644 index 00000000..c8f69a7a --- /dev/null +++ b/Code/nestor/Password_Generator/Password_app/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class PasswordAppConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'Password_app' diff --git a/Code/nestor/Password_Generator/Password_app/migrations/__init__.py b/Code/nestor/Password_Generator/Password_app/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/nestor/Password_Generator/Password_app/models.py b/Code/nestor/Password_Generator/Password_app/models.py new file mode 100644 index 00000000..71a83623 --- /dev/null +++ b/Code/nestor/Password_Generator/Password_app/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/Code/nestor/Password_Generator/Password_app/static/css/styles.css b/Code/nestor/Password_Generator/Password_app/static/css/styles.css new file mode 100644 index 00000000..e6fedbf8 --- /dev/null +++ b/Code/nestor/Password_Generator/Password_app/static/css/styles.css @@ -0,0 +1,5 @@ +body div { + text-align: center; + background-image: url("https://ih1.redbubble.net/image.2223352307.9769/st,small,507x507-pad,600x600,f8f8f8.jpg"); + background-size: cover; +} diff --git a/Code/nestor/Password_Generator/Password_app/templates/Password_app/index.html b/Code/nestor/Password_Generator/Password_app/templates/Password_app/index.html new file mode 100644 index 00000000..64bf96e0 --- /dev/null +++ b/Code/nestor/Password_Generator/Password_app/templates/Password_app/index.html @@ -0,0 +1,28 @@ + +{% load static %} + + + + + + + Password Generator + + +
+
+
+
+
+

Enter in the amount of characters you want your password to be


+

Don't forget to follow the guidelines below:


+

Password must be a minimum of 8 characters

+

Password must not exceed 16 characters

+
+ {% csrf_token %} + + +
+
+ + \ No newline at end of file diff --git a/Code/nestor/Password_Generator/Password_app/templates/Password_app/result.html b/Code/nestor/Password_Generator/Password_app/templates/Password_app/result.html new file mode 100644 index 00000000..ef8fabca --- /dev/null +++ b/Code/nestor/Password_Generator/Password_app/templates/Password_app/result.html @@ -0,0 +1,19 @@ + +{% load static %} + + + + + + + Password Result + + +
+
+
+

Here is you new super secret password...

+ +

{{ password }}

+ + \ No newline at end of file diff --git a/Code/nestor/Password_Generator/Password_app/tests.py b/Code/nestor/Password_Generator/Password_app/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/Code/nestor/Password_Generator/Password_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/Code/nestor/Password_Generator/Password_app/urls.py b/Code/nestor/Password_Generator/Password_app/urls.py new file mode 100644 index 00000000..182d649b --- /dev/null +++ b/Code/nestor/Password_Generator/Password_app/urls.py @@ -0,0 +1,9 @@ +from django.urls import path +from . import views + +app_name = 'Password_app' +urlpatterns = [ + path('', views.index, name='index'), + + path('result/', views.result, name='result') +] diff --git a/Code/nestor/Password_Generator/Password_app/views.py b/Code/nestor/Password_Generator/Password_app/views.py new file mode 100644 index 00000000..51423017 --- /dev/null +++ b/Code/nestor/Password_Generator/Password_app/views.py @@ -0,0 +1,33 @@ +from pickle import GET +from django.shortcuts import render, redirect +from django.http import HttpResponse, HttpResponseRedirect +from secrets import choice +import random +import string +from django.urls import reverse + + +# Create your views here. +def index(request): + return render(request, 'Password_app/index.html') + +def result(request): + number = int(request.POST['name']) + + + while True: + if 7 < number < 17: + break + else: + # return render(request, 'Password_app/index.html') + return HttpResponseRedirect(reverse('Password_app:index')) + + password = list() + char = string.ascii_letters + for x in range(number): + character = random.choice(char) + password.append(character) + print(password) + + + return render(request, 'Password_app/result.html', {'password': password}) \ No newline at end of file diff --git a/Code/nestor/Password_Generator/manage.py b/Code/nestor/Password_Generator/manage.py new file mode 100644 index 00000000..c6c3f97d --- /dev/null +++ b/Code/nestor/Password_Generator/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', 'Password_Generator.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/nestor/ROT_cipher/app.py b/Code/nestor/ROT_cipher/app.py new file mode 100644 index 00000000..f21eab1f --- /dev/null +++ b/Code/nestor/ROT_cipher/app.py @@ -0,0 +1,31 @@ +from flask import Flask, render_template, request +# this creates a python based webserver +app = Flask(__name__) + +def encrypt(text): + # text = input("Please enter in a string: ").lower().replace(" ", "") + cipher = [] + for i in range(len(text)): + char = text[i] + encrypt = ord(char) + 13 + if encrypt < 123: + encrypt = chr(encrypt) + cipher.append(encrypt) + # print(cipher) + elif encrypt >= 122: + repeat = (encrypt % 122) + 96 + repeat = chr(repeat) + cipher.append(repeat) + # print(cipher) + return cipher + +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/ROT_cipher', methods=['POST']) +def ROT_cipher(): + user = request.form['user'] + user1 = user.lower().replace(" ", "") + word = encrypt(user1) + return render_template('ROT_cipher.html', user1=user1, user=user, word=word) \ No newline at end of file diff --git a/Code/nestor/ROT_cipher/templates/ROT_cipher.html b/Code/nestor/ROT_cipher/templates/ROT_cipher.html new file mode 100644 index 00000000..6acb908f --- /dev/null +++ b/Code/nestor/ROT_cipher/templates/ROT_cipher.html @@ -0,0 +1,14 @@ + + + + + + + Cipher + + + Word for encrypting {{ user1 }}
+ word encrypted {{ word }}
+ something {{ user }} + + \ No newline at end of file diff --git a/Code/nestor/ROT_cipher/templates/index.html b/Code/nestor/ROT_cipher/templates/index.html new file mode 100644 index 00000000..3e217239 --- /dev/null +++ b/Code/nestor/ROT_cipher/templates/index.html @@ -0,0 +1,16 @@ + + + + + + + ROT Cipher + + +

Hello

+
+ + +
+ + \ No newline at end of file diff --git a/Code/nestor/capstone/companyLookup.md b/Code/nestor/capstone/companyLookup.md new file mode 100644 index 00000000..053bf966 --- /dev/null +++ b/Code/nestor/capstone/companyLookup.md @@ -0,0 +1,37 @@ +# Project Overview +This project is designed to assist end users with researching companies of interest by consolidating databases and municipalities that contain their company records. +In order to access information pertaining to companies of interest that do not have websites, often it is necessary to research them through the BBB(Better Business Bureau), contact the Department of Consumer Affairs, contact city hall, or attempt to find them through another public database. +This project is designed to consolidate known databases and provide links for municipalities that hold public company information for easy access to the end user. + +# Functionality +**Home Page** +- Welcome page with description of website intent and purpose +- Search bar for easy access to the public databases containing public company records + +**Links Page** +- Links to websites of partnering APIs +- Links to municipalities of every state for local business searches + +**Education** +- Links to education resources for starting your own business + +# Data Model +Data needed to be stored: +- User information +- User search history +- Website information (articles, links, etc.) + +# Schedule +**Week 1** +- Built skeleton of website creating main pages (Home, Links, Education) +- Build backend admin page and test functionality to ensure data is being passed successfully +- Building user profile and user login page +**Week 2** +- Attain API access and test functionality -- testing partner organizations to ensure successful query requests +- Build and test search nav +**Week 3** +- Testing dummy profiles to ensure multi-user access +- Testing database query functionality +- Testing user profile functions(delete profile, create profile, save searches, etc.) +**Week 4** +- Styling and troubleshooting open items \ No newline at end of file diff --git a/Code/nestor/capstone/va_revamp.md b/Code/nestor/capstone/va_revamp.md new file mode 100644 index 00000000..9fe30420 --- /dev/null +++ b/Code/nestor/capstone/va_revamp.md @@ -0,0 +1,56 @@ +# Project Overview +This project is to create a more user friendly interface to help veterans access much needed resources and forms which are hard to locate/obtain +by the VA website. +Due to a lack of needed funding the VA website is currently plagued with old/outdated pages and resources. There are many resources available to veterans for various +needs which are either inaccessible through the VA website or are convoluted making access to the resources incredibly difficult. +In this project I will be utilizing the Django framework to verify veterans, spouses, and active members of the armed forces and help them gain access to forms, programs, job opportunities +and other resources created to honor their sacrifices. +-- include user profile to let user know what they qualify for based on when separated + +# Functionality +**Home Page** +- Welcome page thanking veterans for their sacrifice which also provides a brief description of the utilities of the website +- Will have hamburger bar or search bar to help veterans narrow down on what topics they're looking for +**Links Page** +- Page dedicated to available resources for various fields that the veteran, spouse or service member may need access to +- health care, education, career assistance, housing, disability, unemployment, food and family support, lost records, finances, pension, burials and memorials +**Education** +- Page dedicated to assist with understanding available education benefits as well as alternative programs available for veterans, spouses or separating service members +- GI Bill, Post 9/11, VR&E, VET TEC, etc. +**Career Assistance** +- Page dedicated to helping veterans, spouses and separating service members understand career opportunities that align with their MOS in the civilian sector +- learn about career opportunities outside of their MOS +- Direct them to websites that will assist in resume building, mock interviews and job placement +- Direct them to websites that have veteran preference when selecting candidates +**Health Care** +- Page dedicated to providing necessary forms to fill out for service connected disability, request coverage, file for compensation, etc +- Services available for service members who need to access drug rehab facilities +- Suicide prevention hotlines and centers +**Housing** +- Page dedicated to helping veterans understand what housing resources are available in event of homelessness +- Qualifying for VA loan +**Disability** +- Page dedicated to helping veterans apply for service related disability, file for re-evaluation, dispute compensation, options available for service connected incidents that were not properly documented during time of service +**Finances** +- Page dedicated to helping veterans understand finances, budgets, taxes, pension, options available for veterans facing hardships or need assistance with financing due to hardships + +# Data Model +Data needed to be stored: +- User information +- Forms +- Benefits +- VA Facilities +- Website information (articles, links, etc.) + +# Schedule +**Week 1** +- Built skeleton of website creating main pages (Home, links, education, career assistance, health care, housing, disability and finances) +- Build backend admin page and test functionality to ensure data is being passed successfully +**Week 2** +- Use Benefits API and test functionality -- enables approved organizations to submit benefits-related +- Build and test search nav +**Week 3** +- Building user profile and user login +- testing dummy profiles to ensure website +**Week 4** +- Styling and troubleshooting open items \ No newline at end of file diff --git a/Code/nestor/grocery_proj/grocery_list/__init__.py b/Code/nestor/grocery_proj/grocery_list/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/nestor/grocery_proj/grocery_list/admin.py b/Code/nestor/grocery_proj/grocery_list/admin.py new file mode 100644 index 00000000..e89576c2 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_list/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin +from .models import Department, GroceryItem + +# Register your models here. +admin.site.register(GroceryItem) +admin.site.register(Department) \ No newline at end of file diff --git a/Code/nestor/grocery_proj/grocery_list/apps.py b/Code/nestor/grocery_proj/grocery_list/apps.py new file mode 100644 index 00000000..0af6fbb4 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_list/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class GroceryListConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'grocery_list' diff --git a/Code/nestor/grocery_proj/grocery_list/migrations/0001_initial.py b/Code/nestor/grocery_proj/grocery_list/migrations/0001_initial.py new file mode 100644 index 00000000..811818f9 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_list/migrations/0001_initial.py @@ -0,0 +1,26 @@ +# Generated by Django 4.0.3 on 2022-04-01 03:27 + +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='GroceryItem', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('list_item', models.CharField(max_length=200)), + ('completed', models.BooleanField(default=False)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/Code/nestor/grocery_proj/grocery_list/migrations/0002_rename_list_item_groceryitem_items.py b/Code/nestor/grocery_proj/grocery_list/migrations/0002_rename_list_item_groceryitem_items.py new file mode 100644 index 00000000..e862d351 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_list/migrations/0002_rename_list_item_groceryitem_items.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.3 on 2022-04-01 04:14 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('grocery_list', '0001_initial'), + ] + + operations = [ + migrations.RenameField( + model_name='groceryitem', + old_name='list_item', + new_name='items', + ), + ] diff --git a/Code/nestor/grocery_proj/grocery_list/migrations/0003_department_remove_groceryitem_items_and_more.py b/Code/nestor/grocery_proj/grocery_list/migrations/0003_department_remove_groceryitem_items_and_more.py new file mode 100644 index 00000000..639882f1 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_list/migrations/0003_department_remove_groceryitem_items_and_more.py @@ -0,0 +1,40 @@ +# Generated by Django 4.0.3 on 2022-04-13 01:33 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('grocery_list', '0002_rename_list_item_groceryitem_items'), + ] + + operations = [ + migrations.CreateModel( + name='Department', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=20)), + ], + ), + migrations.RemoveField( + model_name='groceryitem', + name='items', + ), + migrations.RemoveField( + model_name='groceryitem', + name='user', + ), + migrations.AddField( + model_name='groceryitem', + name='item', + field=models.CharField(default=0, max_length=40), + preserve_default=False, + ), + migrations.AddField( + model_name='groceryitem', + name='department', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='items', to='grocery_list.department'), + ), + ] diff --git a/Code/nestor/grocery_proj/grocery_list/migrations/__init__.py b/Code/nestor/grocery_proj/grocery_list/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/nestor/grocery_proj/grocery_list/models.py b/Code/nestor/grocery_proj/grocery_list/models.py new file mode 100644 index 00000000..33b21932 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_list/models.py @@ -0,0 +1,18 @@ + +from django.db import models +from django.contrib.auth.models import User + +class Department(models.Model): + name = models.CharField(max_length=20) + + def __str__(self): + return f'{self.name}' + +class GroceryItem(models.Model): + item = models.CharField(max_length=40) + completed = models.BooleanField(default=False) + department = models.ForeignKey(Department, on_delete=models.CASCADE, related_name='items', null=True, blank=True) + + def __str__(self): + return f'{self.item} -- {self.completed}' + \ No newline at end of file diff --git a/Code/nestor/grocery_proj/grocery_list/templates/grocery_list/index.html b/Code/nestor/grocery_proj/grocery_list/templates/grocery_list/index.html new file mode 100644 index 00000000..e766568c --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_list/templates/grocery_list/index.html @@ -0,0 +1,62 @@ + + + + + + + Grocery List + + +

Create a grocery list

+

Add your items below.

+
+ {% csrf_token %} + + + + + {% for department in departments %} +
+

{{department.name}}

+ +
+ {% endfor %} +
+ + + + + + + + \ No newline at end of file diff --git a/Code/nestor/grocery_proj/grocery_list/templates/grocery_list/items.html b/Code/nestor/grocery_proj/grocery_list/templates/grocery_list/items.html new file mode 100644 index 00000000..795b8a39 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_list/templates/grocery_list/items.html @@ -0,0 +1,20 @@ + + + + + + + Grocery Items List + + +

Grocery List

+ + + \ No newline at end of file diff --git a/Code/nestor/grocery_proj/grocery_list/tests.py b/Code/nestor/grocery_proj/grocery_list/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_list/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/Code/nestor/grocery_proj/grocery_list/urls.py b/Code/nestor/grocery_proj/grocery_list/urls.py new file mode 100644 index 00000000..7aba3819 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_list/urls.py @@ -0,0 +1,11 @@ +from django.urls import path +from .import views + +app_name = 'grocery_list' + +urlpatterns = [ + path('', views.index, name='index'), + path('add_item', views.add_item, name='add'), + path('buy//', views.buy_item, name='buy'), + path('delete/', views.delete_item, name='delete'), +] diff --git a/Code/nestor/grocery_proj/grocery_list/views.py b/Code/nestor/grocery_proj/grocery_list/views.py new file mode 100644 index 00000000..94efab01 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_list/views.py @@ -0,0 +1,101 @@ +from django.shortcuts import redirect, render, get_object_or_404 +from django.http import HttpResponse, HttpResponseRedirect +from django.urls import reverse +from .import models + + +# Create your views here. + + +def index(request): + grocery_list = models.GroceryItem.objects.all().order_by('department') + departments = models.Department.objects.all().order_by('name') + + return render(request, 'grocery_list/index.html', { + 'grocery_list': grocery_list, + 'departments': departments + }) + +def add_item(request): + item_text = request.POST['item'] + department_id = request.POST['department'] + new_item = models.GroceryItem() + new_item.item = item_text + if department_id: + department = models.Department.objects.get(id=department_id) + new_item.department = department + new_item.save() + return HttpResponseRedirect(reverse('grocery_list:index')) + +def buy_item(request, item_id): + grocery_item = models.GroceryItem.objects.get(id=item_id) + grocery_item.completed = not grocery_item.completed + grocery_item.save() + return HttpResponseRedirect(reverse('grocery_list:index')) + +def delete_item(request, item_id): + grocery_item = models.GroceryItem.objects.get(id=item_id) + grocery_item.delete() + return HttpResponseRedirect(reverse('grocery_list:index')) + + + + + + + + + + + + + # items = GroceryItem.objects.filter(user=request.user) + # database = GroceryItem.objects.all() + # context = { + # 'items': items, + # # 'database': database + # } + # return render(request, 'grocery_list/index.html', context) + +# def list(request): + # if request.method == 'POST': + # data = request.POST['items'] + # user = request.user + # grocery_item = GroceryItem() + # grocery_item.items = data + # grocery_item.save() + # context = { + # 'all': data, + # 'database': database + # } + # return render(request, 'grocery_list/items.html', context) + + +# def grocery_add(request, grocery_id): +# item = GroceryItem.objects.get(id=grocery_id) +# database = GroceryItem.objects.all() +# item.save() +# context = { +# 'database': database, +# } +# return render(request, 'grocery_list/items.html', context) + + + + + + + + +# if request.method == 'POST': + +# print(request.POST) + +# description = request.POST["description"] +# created_date = request.POST["created_date"] +# completed_date = None +# completed = False + +# new_item = GroceryItem(description = description, created_date = created_date, completed_date = completed_date, completed=completed) + + \ No newline at end of file diff --git a/Code/nestor/grocery_proj/grocery_proj/__init__.py b/Code/nestor/grocery_proj/grocery_proj/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/nestor/grocery_proj/grocery_proj/asgi.py b/Code/nestor/grocery_proj/grocery_proj/asgi.py new file mode 100644 index 00000000..9012ee82 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_proj/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for grocery_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_proj.settings') + +application = get_asgi_application() diff --git a/Code/nestor/grocery_proj/grocery_proj/settings.py b/Code/nestor/grocery_proj/grocery_proj/settings.py new file mode 100644 index 00000000..3c04d615 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_proj/settings.py @@ -0,0 +1,125 @@ +""" +Django settings for grocery_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-ia&x#8m3ttr^*txt3zaad0wh(qgrf=e(!l2j_f_#zya@dl1o0)' + +# 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', + + 'grocery_list' +] + +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 = 'grocery_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 = 'grocery_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 = '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/nestor/grocery_proj/grocery_proj/urls.py b/Code/nestor/grocery_proj/grocery_proj/urls.py new file mode 100644 index 00000000..4f5fc26b --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_proj/urls.py @@ -0,0 +1,22 @@ +"""grocery_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('grocery/', include('grocery_list.urls')) +] diff --git a/Code/nestor/grocery_proj/grocery_proj/wsgi.py b/Code/nestor/grocery_proj/grocery_proj/wsgi.py new file mode 100644 index 00000000..567bce68 --- /dev/null +++ b/Code/nestor/grocery_proj/grocery_proj/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for grocery_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', 'grocery_proj.settings') + +application = get_wsgi_application() diff --git a/Code/nestor/grocery_proj/manage.py b/Code/nestor/grocery_proj/manage.py new file mode 100644 index 00000000..f97e4e6d --- /dev/null +++ b/Code/nestor/grocery_proj/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', 'grocery_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/nestor/html_css/index_styles/lab03.css b/Code/nestor/html_css/index_styles/lab03.css new file mode 100644 index 00000000..afd9124e --- /dev/null +++ b/Code/nestor/html_css/index_styles/lab03.css @@ -0,0 +1,142 @@ +.donut { + background-image: url("http://sesamedonuts.com/images-occassions/valentine2.jpg"); + min-height: 75%; + background-position: center; + background-size: cover; + +} +.logo { + display: flex; + justify-content: center; +} +.logo img { + /* background-position: center; */ + background-position: center; + width: 50%; + height: 100%; + max-height: 300px; + margin: 70px; + /* background-repeat: no-repeat; */ +} +.deal { + display: flex; + justify-content: row; +} +.promotion img { + max-width: 100%; + max-height: 100%; + border: solid white 4px; + vertical-align: middle; + box-sizing: content-box; + object-fit: cover; +} +.valentine img { + max-width: 100%; + max-height: 100%; + vertical-align: middle; + box-sizing: content-box; + border: solid white 4px +} +.promotion, .valentine { + width: 50%; +} +.locations h1 { + font-size: 2.5rem; + color: white; + background-color: #FFCCFF; + text-align: center; + margin: 0px; + padding: 10px 10px; +} +.locations { + display: block; + max-width: 100%; + max-height: 100%; + box-sizing: border-box; +} +.portland-locations { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + padding: 0%; + margin: 0%; +} +.portland-locations div { + max-width: 33%; + padding: 0%; + margin: 0%; + display: flex; + flex-direction: row; + flex-wrap: wrap; +} +#raleigh img { + border: 1px solid pink; + max-width: 100%; +} +#tigard-scholls img { + border: 1px solid pink; + max-width: 100%; +} +#tigard img { + border: 1px solid pink; + max-width: 100%; +} +#sherwood img { + border: 1px solid pink; + max-width: 100%; +} +#aloha img { + border: 1px solid pink; + max-width: 100%; +} +#downtown img { + border: 1px solid pink; + max-width: 100%; +} +#east img { + border: 1px solid pink; + max-width: 100%; +} +#hillsboro img { + border: 1px solid pink; + max-width: 100%; +} +#join-team { + display: flex; + flex-direction: row; + background-color: #FFCCFF; +} +#join-team img { + justify-content: start; + max-width: 30%; + max-height: 30%; + padding: 30px; +} +#application { + display: flex; + flex-direction: column; + color: whitesmoke; + font-size: 30px; + align-items: center; + margin-left: 25%; +} +#application p { + align-items: center; + margin-top: 30%; +} +#application form button { + background-color: whitesmoke; + color: #FFCCFF; + border: #FFCCFF; +} +.redirect { + display: flex; + text-decoration: none; + text-size-adjust: 20px; + background-color: #FFCCFF; + justify-content: space-evenly; + padding: 10px; + font-size: 30px; + color: white; +} \ No newline at end of file diff --git a/Code/nestor/html_css/index_styles/lab03.html b/Code/nestor/html_css/index_styles/lab03.html new file mode 100644 index 00000000..22fa4af4 --- /dev/null +++ b/Code/nestor/html_css/index_styles/lab03.html @@ -0,0 +1,94 @@ + + + + + + + Lab 3: Company Home + + + + + + + +
+ +
+
+
+ Valentine Donuts Decorating Kits +
+
+ Valentine donut picture +
+
+
+

+ Check out our Locations Around Portland! +

+
+
+
+ + Raleigh Hills Sesame Donut Location + +
+
+ + Tigard-Scholls Sesame Donut Location + +
+
+ + Tigard (HWY 99) Sesame Donut Location + +
+
+ + Sherwood Sesame Donut Location + +
+
+ + Aloha Sesame Donut Location + +
+
+ + Downtown Portland Sesame Donut Location + +
+
+ + East Portland Sesame Donut Location + +
+
+ + Hillsboro Sesame Donut Location + +
+
+
+ cook kneading dough +
+

+ JOIN THE SESAME TEAM TODAY! +

+
+ +
+
+
+
+ + + \ No newline at end of file diff --git a/Code/nestor/javascript/lab01/app.js b/Code/nestor/javascript/lab01/app.js new file mode 100644 index 00000000..0f9356c4 --- /dev/null +++ b/Code/nestor/javascript/lab01/app.js @@ -0,0 +1,78 @@ +const userInput = document.querySelector('#user-input') +const button = document.querySelector('#submit') +const resultsList = document.querySelector('#results-list') +// let encryptWord = String(word).toLowerCase().replace(' ', '') + + +button.addEventListener('click', function(event){ + event.preventDefault() + const li = document.createElement('li') + const span = document.createElement('span') + const word = userInput.value + + // console.log(encrypt(word)) + resultsList.append(encrypt(word)) + + +}) + +// span.textContent = resultsList +// li.append(span) +// console.log(cipher) +// console.log(encryptWord) + +let text = String(userInput.value).toLowerCase().replace(' ', '') +let cipher = [] + +function encrypt(text){ + let newEncrypt = [] + + for(let i=0; i= 122){ + repeat = (encrypt % 122) + 96 + repeat = String.fromCharCode(repeat) + newEncrypt.push(repeat) + // console.log(newEncrypt) + } + }) + return newEncrypt +} + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Code/nestor/javascript/lab01/index.html b/Code/nestor/javascript/lab01/index.html new file mode 100644 index 00000000..941ba89b --- /dev/null +++ b/Code/nestor/javascript/lab01/index.html @@ -0,0 +1,23 @@ + + + + + + + Number to Phase + + + +

Please enter the string you want to encrypt

+

+
+ + +
+ +

Here is your encrypted string

+

+
    +

    + + \ No newline at end of file diff --git a/Code/nestor/javascript/lab02/app.js b/Code/nestor/javascript/lab02/app.js new file mode 100644 index 00000000..4b50a8f1 --- /dev/null +++ b/Code/nestor/javascript/lab02/app.js @@ -0,0 +1,33 @@ +const todoInput = document.querySelector('#todo-input') +const todoBtn = document.querySelector('#todo-btn') +const todoList = document.querySelector('#todo-list') + +todoBtn.addEventListener('click', addItem) +todoInput.addEventListener('keypress', function(event){ + console.log(event) + if(event.key === 'Enter'){ + addItem() + } +}) + +function addItem(){ + const newItem = todoInput.value + console.log(newItem) + const li = document.createElement('li') + todoList.append(li) + li.append(newItem) + + const delBtn = document.createElement('button') + delBtn.textContent = 'del' + li.append(delBtn) + delBtn.addEventListener('click', function(){ + todoList.removeChild(delBtn.parentElement) // remove button from parent + }) + + const complete = document.createElement('button') + complete.textContent = '☑' + li.append(complete) + complete.addEventListener('click', function(){ + li.style.textDecoration = 'line-through' + }) +} \ No newline at end of file diff --git a/Code/nestor/javascript/lab02/index.html b/Code/nestor/javascript/lab02/index.html new file mode 100644 index 00000000..bb285d61 --- /dev/null +++ b/Code/nestor/javascript/lab02/index.html @@ -0,0 +1,21 @@ + + + + + + + Document + + + +

    Todo List:

    +
    +
    +

    Add items below

    + + +
      + +
    + + \ No newline at end of file diff --git a/Code/nestor/lab02.py b/Code/nestor/lab02.py index 1519eb2e..0c33a4ca 100644 --- a/Code/nestor/lab02.py +++ b/Code/nestor/lab02.py @@ -9,7 +9,7 @@ # creating variable to find average of list and printing results num_sum = sum(numbers) // len(numbers) -print(f"Average: {num_sum}") +print(f"Average: {num_sum}") # Version 2 diff --git a/Code/nestor/todo_project/manage.py b/Code/nestor/todo_project/manage.py new file mode 100644 index 00000000..1d0193af --- /dev/null +++ b/Code/nestor/todo_project/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', 'todo_project.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/nestor/todo_project/todo_app/__init__.py b/Code/nestor/todo_project/todo_app/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/nestor/todo_project/todo_app/admin.py b/Code/nestor/todo_project/todo_app/admin.py new file mode 100644 index 00000000..1f049942 --- /dev/null +++ b/Code/nestor/todo_project/todo_app/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin +from .import models + +# Register your models here. +admin.site.register(models.Priority), +admin.site.register(models.TodoItem) \ No newline at end of file diff --git a/Code/nestor/todo_project/todo_app/apps.py b/Code/nestor/todo_project/todo_app/apps.py new file mode 100644 index 00000000..d8f1498d --- /dev/null +++ b/Code/nestor/todo_project/todo_app/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class TodoAppConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'todo_app' diff --git a/Code/nestor/todo_project/todo_app/forms.py b/Code/nestor/todo_project/todo_app/forms.py new file mode 100644 index 00000000..1c4d4b41 --- /dev/null +++ b/Code/nestor/todo_project/todo_app/forms.py @@ -0,0 +1,6 @@ +from django import forms +from django.forms import ModelForm +from .models import * + +class NewItem(forms.Form): + item = forms.CharField(label='item', max_length=120) \ No newline at end of file diff --git a/Code/nestor/todo_project/todo_app/migrations/0001_initial.py b/Code/nestor/todo_project/todo_app/migrations/0001_initial.py new file mode 100644 index 00000000..44b15f17 --- /dev/null +++ b/Code/nestor/todo_project/todo_app/migrations/0001_initial.py @@ -0,0 +1,30 @@ +# Generated by Django 4.0.3 on 2022-04-08 02:31 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Priority', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ], + ), + migrations.CreateModel( + name='TodoItem', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('text', models.CharField(max_length=120)), + ('created_date', models.DateTimeField(auto_now_add=True)), + ('priority', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='todo_app.priority')), + ], + ), + ] diff --git a/Code/nestor/todo_project/todo_app/migrations/0002_rename_text_todoitem_item_todoitem_complete.py b/Code/nestor/todo_project/todo_app/migrations/0002_rename_text_todoitem_item_todoitem_complete.py new file mode 100644 index 00000000..20212b0b --- /dev/null +++ b/Code/nestor/todo_project/todo_app/migrations/0002_rename_text_todoitem_item_todoitem_complete.py @@ -0,0 +1,23 @@ +# Generated by Django 4.0.3 on 2022-04-15 02:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('todo_app', '0001_initial'), + ] + + operations = [ + migrations.RenameField( + model_name='todoitem', + old_name='text', + new_name='item', + ), + migrations.AddField( + model_name='todoitem', + name='complete', + field=models.BooleanField(default=False), + ), + ] diff --git a/Code/nestor/todo_project/todo_app/migrations/0003_rename_created_date_todoitem_created_and_more.py b/Code/nestor/todo_project/todo_app/migrations/0003_rename_created_date_todoitem_created_and_more.py new file mode 100644 index 00000000..1dffb3dd --- /dev/null +++ b/Code/nestor/todo_project/todo_app/migrations/0003_rename_created_date_todoitem_created_and_more.py @@ -0,0 +1,29 @@ +# Generated by Django 4.0.3 on 2022-04-15 03:01 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('todo_app', '0002_rename_text_todoitem_item_todoitem_complete'), + ] + + operations = [ + migrations.RenameField( + model_name='todoitem', + old_name='created_date', + new_name='created', + ), + migrations.RenameField( + model_name='todoitem', + old_name='item', + new_name='text', + ), + migrations.AlterField( + model_name='todoitem', + name='priority', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='related', to='todo_app.priority'), + ), + ] diff --git a/Code/nestor/todo_project/todo_app/migrations/0004_priority_item.py b/Code/nestor/todo_project/todo_app/migrations/0004_priority_item.py new file mode 100644 index 00000000..748afef5 --- /dev/null +++ b/Code/nestor/todo_project/todo_app/migrations/0004_priority_item.py @@ -0,0 +1,19 @@ +# Generated by Django 4.0.3 on 2022-04-15 03:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('todo_app', '0003_rename_created_date_todoitem_created_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='priority', + name='item', + field=models.CharField(default=1, max_length=120), + preserve_default=False, + ), + ] diff --git a/Code/nestor/todo_project/todo_app/migrations/__init__.py b/Code/nestor/todo_project/todo_app/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/nestor/todo_project/todo_app/models.py b/Code/nestor/todo_project/todo_app/models.py new file mode 100644 index 00000000..dbcd09f4 --- /dev/null +++ b/Code/nestor/todo_project/todo_app/models.py @@ -0,0 +1,23 @@ +from email import charset +from tkinter import CASCADE +from unicodedata import name +from django.db import models +from django.forms import CharField + + +# Create your models here. +class Priority(models.Model): + item = models.CharField(max_length=120) + + def __str__(self): + return f'{self.item}' + +class TodoItem(models.Model): + text = models.CharField(max_length=120) + priority = models.ForeignKey(Priority, on_delete=models.CASCADE, related_name='related') + created = models.DateTimeField(auto_now_add=True) + complete = models.BooleanField(default=False) + + def __str__(self): + return f'{self.text} -- {self.priority}' + \ No newline at end of file diff --git a/Code/nestor/todo_project/todo_app/templates/todo_app/index.html b/Code/nestor/todo_project/todo_app/templates/todo_app/index.html new file mode 100644 index 00000000..bf62495f --- /dev/null +++ b/Code/nestor/todo_project/todo_app/templates/todo_app/index.html @@ -0,0 +1,48 @@ + + + + + + + Index + + +

    Todo Project

    +

    Items to complete

    + {% comment %} + {% for todo in todos %} +
    + {{todo}} +
    + {% endfor %} + {% endcomment %} + + {% for priority in priorities %} +
    +

    {{priority.item}}

    +
      + {% for x in priority.related.all %} +
      + {{x}} +
      + {% endfor %} +
    +
    + {% endfor %} + + + +
    + {% csrf_token %} + + + + +
    + + \ No newline at end of file diff --git a/Code/nestor/todo_project/todo_app/templates/todo_app/save.html b/Code/nestor/todo_project/todo_app/templates/todo_app/save.html new file mode 100644 index 00000000..7b1c89e4 --- /dev/null +++ b/Code/nestor/todo_project/todo_app/templates/todo_app/save.html @@ -0,0 +1,12 @@ + + + + + + + Todo Items + + +

    List of items

    + + \ No newline at end of file diff --git a/Code/nestor/todo_project/todo_app/tests.py b/Code/nestor/todo_project/todo_app/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/Code/nestor/todo_project/todo_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/Code/nestor/todo_project/todo_app/urls.py b/Code/nestor/todo_project/todo_app/urls.py new file mode 100644 index 00000000..33a63458 --- /dev/null +++ b/Code/nestor/todo_project/todo_app/urls.py @@ -0,0 +1,9 @@ +from django.urls import path +from .import views + +app_name = 'todo_app' + +urlpatterns = [ + path('', views.index, name='index'), + path('save/', views.save, name='save') +] \ No newline at end of file diff --git a/Code/nestor/todo_project/todo_app/views.py b/Code/nestor/todo_project/todo_app/views.py new file mode 100644 index 00000000..fd4693cf --- /dev/null +++ b/Code/nestor/todo_project/todo_app/views.py @@ -0,0 +1,28 @@ +from django.shortcuts import render +from django.http import HttpResponseRedirect +from django.urls import reverse +from .models import Priority, TodoItem +from .forms import * + +# Create your views here. +def index(request): + todos = TodoItem.objects.all() + priorities = Priority.objects.all() + + context = { + 'todos': todos, + 'priorities': priorities + } + return render(request, 'todo_app/index.html', context) + +def save(request): + if request.method == 'POST': + todo_text = request.POST['text'] + priority_id = request.POST['priority'] + new_item = TodoItem() + new_item.text = todo_text + if priority_id: + priority = Priority.objects.get(id=priority_id) + new_item.priority = priority + new_item.save() + return HttpResponseRedirect(reverse('todo_app:index')) diff --git a/Code/nestor/todo_project/todo_project/__init__.py b/Code/nestor/todo_project/todo_project/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Code/nestor/todo_project/todo_project/asgi.py b/Code/nestor/todo_project/todo_project/asgi.py new file mode 100644 index 00000000..8c53ccad --- /dev/null +++ b/Code/nestor/todo_project/todo_project/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for todo_project 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', 'todo_project.settings') + +application = get_asgi_application() diff --git a/Code/nestor/todo_project/todo_project/settings.py b/Code/nestor/todo_project/todo_project/settings.py new file mode 100644 index 00000000..fcb02a5f --- /dev/null +++ b/Code/nestor/todo_project/todo_project/settings.py @@ -0,0 +1,125 @@ +""" +Django settings for todo_project 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-!-fzm()wp5iunxc(wvto0btv^m8q=lnl1e59157mh7moc*%pbu' + +# 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', + + 'todo_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 = 'todo_project.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 = 'todo_project.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/nestor/todo_project/todo_project/urls.py b/Code/nestor/todo_project/todo_project/urls.py new file mode 100644 index 00000000..0f345840 --- /dev/null +++ b/Code/nestor/todo_project/todo_project/urls.py @@ -0,0 +1,22 @@ +"""todo_project 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('', include('todo_app.urls')) +] \ No newline at end of file diff --git a/Code/nestor/todo_project/todo_project/wsgi.py b/Code/nestor/todo_project/todo_project/wsgi.py new file mode 100644 index 00000000..aaa51438 --- /dev/null +++ b/Code/nestor/todo_project/todo_project/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for todo_project 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', 'todo_project.settings') + +application = get_wsgi_application()