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

lab12 ATM w/ Version 2 #144

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
822bf98
lab12 ATM w/ Version 2
JohnnyMurph22 Mar 2, 2022
d3e445d
Lab 12 corrections made, per @IrronWilliams comments, added print tra…
JohnnyMurph22 Mar 5, 2022
42063c9
committing lab 1 HTML/CSS
JohnnyMurph22 Mar 5, 2022
69e40a0
Lab2 HTML in-progress
JohnnyMurph22 Mar 10, 2022
e8be06f
Lab 14 Dad Joke API
JohnnyMurph22 Mar 11, 2022
74b6e37
Lab 3 in-progress
JohnnyMurph22 Mar 15, 2022
e2e62c0
Lab 3 html and css files
JohnnyMurph22 Mar 16, 2022
c649fbe
Lab 5 In-Progress
JohnnyMurph22 Mar 16, 2022
af76f41
Lab 5 Forms: Complete
JohnnyMurph22 Mar 18, 2022
abcd79b
Lab 6: Flask ROT13 CIPHER -- In-Progress
JohnnyMurph22 Mar 19, 2022
bcd57eb
Lab6 Flask ROT13
JohnnyMurph22 Mar 22, 2022
5405ffc
Django tutorials + Lab 1-in-progress
JohnnyMurph22 Mar 25, 2022
de18282
Django_Redo_Lab1 -- still in-progress; Day 4 -- still troubleshooting…
JohnnyMurph22 Mar 31, 2022
155664a
Lab1 Django - complete/ template inheritance demo
JohnnyMurph22 Apr 1, 2022
b9b6d5b
Django_Lab2 Grocery List in-progress
JohnnyMurph22 Apr 1, 2022
9ebd5ee
todo project demo
JohnnyMurph22 Apr 5, 2022
de723cb
Lab 2 todo_proj; in-progress
JohnnyMurph22 Apr 8, 2022
a0eac4e
Grocery_app - working
JohnnyMurph22 Apr 12, 2022
0a726c4
I've been referencing 'https://ireadblog.com/accounts/profile/ashutos…
JohnnyMurph22 Apr 12, 2022
f42d4e8
Grocery Lab -- Mob
JohnnyMurph22 Apr 13, 2022
b59b331
Mob lab phone book
JohnnyMurph22 Apr 14, 2022
0d71689
Todo Lab updates
JohnnyMurph22 Apr 15, 2022
0ea4d80
Java Lab 1 - inprogress/day 1
JohnnyMurph22 Apr 21, 2022
e6bde9c
Lab 1 Java inprogress day2; still debugging incrementscore function/ …
JohnnyMurph22 Apr 22, 2022
05fe514
Todo Labs
JohnnyMurph22 Apr 26, 2022
7a08df4
Jave Lab2 complete-- class nts 4/26
JohnnyMurph22 Apr 27, 2022
9722ea2
Django Blog Lab Redo
JohnnyMurph22 Apr 28, 2022
912669a
Java Lab 1 redo 'RPS'
JohnnyMurph22 Apr 29, 2022
f9e1bf9
RPS redo finished - type2
JohnnyMurph22 Apr 30, 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
Empty file.
6 changes: 6 additions & 0 deletions Code/johnathan/Django_Chirp_Proj/Chirp/chirpy_app/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib import admin
from .models import Cheep

# Register your models here.

admin.site.register(Cheep)
6 changes: 6 additions & 0 deletions Code/johnathan/Django_Chirp_Proj/Chirp/chirpy_app/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class ChirpyAppConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'chirpy_app'
Empty file.
14 changes: 14 additions & 0 deletions Code/johnathan/Django_Chirp_Proj/Chirp/chirpy_app/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from tkinter import CASCADE
from django.db import models
from django.contrib.auth.models import User
# Create your models here.

class Cheep(models.Model):
chirp = models.CharField(max_length=120)
date_published = models.DateTimeField(auto_now=True)
user =models.ForeignKey(User, on_delete=models.CASCADE)
deleted = models.BooleanField(default=False)

def __str__(self):
return f'{self.user}: {self.date_published} -- {self.chirp}'

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!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>Chirp</title>
</head>
<body>
<h1> Welcome to Class Kiwi Chirpy</h1>

<form action="{% url 'save' %}" method="POST">
{% csrf_token %}
{{form}}
<button> Cheep!</button>
</form>
</body>
</html>
3 changes: 3 additions & 0 deletions Code/johnathan/Django_Chirp_Proj/Chirp/chirpy_app/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.
9 changes: 9 additions & 0 deletions Code/johnathan/Django_Chirp_Proj/Chirp/chirpy_app/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django import views
from django.urls import path
from .import views


urlpatterns = [
path('', views.index, name='index')
path('save/', views.save_cheep, name='save')
]
33 changes: 33 additions & 0 deletions Code/johnathan/Django_Chirp_Proj/Chirp/chirpy_app/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from django.shortcuts import render
from django import forms
from django.http import HttpResponseRedirect
from django.urls import reverse
from .models import Cheep


class NewCheepForm(forms.Form):
text = forms.CharField(label='Cheep your thoughts here', )

# Create your views here.
def index(request):
return render(request, 'chirpy_app/index.html', {
'form': NewCheepForm()
})

def save_cheep(request):
if request.method == 'Post':
form = NewCheepForm(request.POST)
if form.is_valid():
text = form.cleaned_data['text']
user = request.user

cheep = Cheep()
cheep.chirp = text
cheep.user = user
cheep.save()

return HttpResponseRedirect(reverse('index'))

# return render(request, 'chirpy_app/index.html', {
# 'form':NewCheepForm()
# })
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for chirpy_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', 'chirpy_proj.settings')

application = get_asgi_application()
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
"""
Django settings for chirpy_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-_&68jan7*_^zq_sj4_6i@&e6#pmg_ed9#3sak@ep^zwz6)$8%@'

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


'chirpy_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 = 'chirpy_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 = 'chirpy_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'
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""chirpy_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('chirp/', include('chirpy_app.urls'))
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for chirpy_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', 'chirpy_proj.settings')

application = get_wsgi_application()
22 changes: 22 additions & 0 deletions Code/johnathan/Django_Chirp_Proj/Chirp/chirpy_proj/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', 'chirpy_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()
Empty file.
16 changes: 16 additions & 0 deletions Code/johnathan/Django_Grocery_Lab2/Django_Grocery_Lab2/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for Django_Grocery_Lab2 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_Grocery_Lab2.settings')

application = get_asgi_application()
Loading