diff --git a/.DS_Store b/.DS_Store
index 4c0ce55..f99d8f9 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/__init__.py b/erica_snider/Assignments/Python/Django/courses/apps/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/__init__.pyc b/erica_snider/Assignments/Python/Django/courses/apps/__init__.pyc
new file mode 100644
index 0000000..1a2e68e
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/apps/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/__init__.py b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/__init__.pyc b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/__init__.pyc
new file mode 100644
index 0000000..138a43b
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/admin.py b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/admin.pyc b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/admin.pyc
new file mode 100644
index 0000000..b17f1d5
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/apps.py b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/apps.py
new file mode 100644
index 0000000..4cfa704
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class CoursesAppConfig(AppConfig):
+ name = 'courses_app'
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/migrations/0001_initial.py b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/migrations/0001_initial.py
new file mode 100644
index 0000000..aed5cdf
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/migrations/0001_initial.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-03-18 16:49
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Course',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=255)),
+ ('description', models.TextField(max_length=1000)),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('updated_at', models.DateTimeField(auto_now=True)),
+ ],
+ ),
+ ]
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/migrations/0001_initial.pyc b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/migrations/0001_initial.pyc
new file mode 100644
index 0000000..a9029dc
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/migrations/0001_initial.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/migrations/__init__.py b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/migrations/__init__.pyc
new file mode 100644
index 0000000..0cc5b36
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/models.py b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/models.py
new file mode 100644
index 0000000..2bf2410
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/models.py
@@ -0,0 +1,10 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+# Create your models here.
+class Course(models.Model):
+ name = models.CharField(max_length=255)
+ description = models.TextField(max_length=1000)
+ created_at = models.DateTimeField(auto_now_add = True)
+ updated_at = models.DateTimeField(auto_now = True)
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/models.pyc b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/models.pyc
new file mode 100644
index 0000000..c2041e5
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/templates/destroy.html b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/templates/destroy.html
new file mode 100644
index 0000000..0db8504
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/templates/destroy.html
@@ -0,0 +1,20 @@
+
+
+
+
+ Destroy?
+
+
+ Are you sure you want to delete the following course?
+ Name: {{course.name}}
+ Description: {{course.description}}
+
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/templates/index.html b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/templates/index.html
new file mode 100644
index 0000000..1124981
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/templates/index.html
@@ -0,0 +1,42 @@
+
+
+
+
+ Courses
+
+
+ Add a new course
+
+
+ Courses
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/tests.py b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/urls.py b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/urls.py
new file mode 100644
index 0000000..9df671e
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/urls.py
@@ -0,0 +1,9 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index),
+ url(r'^courses/add$', views.add),
+ url(r'^courses/destroy/(?P\d+)$', views.destroy),
+ url(r'^courses/delete/(?P\d+)$', views.delete),
+]
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/urls.pyc b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/urls.pyc
new file mode 100644
index 0000000..acd403e
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/views.py b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/views.py
new file mode 100644
index 0000000..461b989
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/views.py
@@ -0,0 +1,35 @@
+from django.shortcuts import render, redirect
+from .models import Course
+
+# url METHOD METHOD DIRECTION
+# / def index (show form and data) render template index.html
+# #/courses/add/validate def validate redirect(/add)
+# /courses/add def add (add to db) redirect(/)
+# /courses/destroy/ def destroy render template destroy.html
+# /courses/delete/ def delete redirect(/)
+
+def index(request):
+ context = {
+ "courses": Course.objects.all(),
+ }
+ return render(request, 'index.html', context)
+
+# ADD VALIDATION - here, or in models?...
+# def useradd(request):
+# return redirect('/add')
+
+def add(request):
+ name = request.POST['name']
+ description = request.POST['description']
+ Course.objects.create(name=name, description=description)
+ return redirect('/')
+
+
+def destroy(request, id):
+ course = Course.objects.get(id=id)
+ context = {'course':course}
+ return render(request, 'destroy.html', context)
+
+def delete(request, id):
+ Course.objects.filter(id=id).delete()
+ return redirect('/')
diff --git a/erica_snider/Assignments/Python/Django/courses/apps/courses_app/views.pyc b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/views.pyc
new file mode 100644
index 0000000..b85d965
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/apps/courses_app/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/courses/__init__.py b/erica_snider/Assignments/Python/Django/courses/courses/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/courses/courses/__init__.pyc b/erica_snider/Assignments/Python/Django/courses/courses/__init__.pyc
new file mode 100644
index 0000000..655c783
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/courses/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/courses/settings.py b/erica_snider/Assignments/Python/Django/courses/courses/settings.py
new file mode 100644
index 0000000..4c7ab87
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/courses/settings.py
@@ -0,0 +1,121 @@
+"""
+Django settings for courses project.
+
+Generated by 'django-admin startproject' using Django 1.10.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.10/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.10/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'nr-&nf5-h03v5^&+t+%(cn0n(c=z^d8c_%*8^so$uol*0(**n&'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'apps.courses_app',
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+]
+
+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 = 'courses.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 = 'courses.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.10/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/1.10/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.10/howto/static-files/
+
+STATIC_URL = '/static/'
diff --git a/erica_snider/Assignments/Python/Django/courses/courses/settings.pyc b/erica_snider/Assignments/Python/Django/courses/courses/settings.pyc
new file mode 100644
index 0000000..497bc07
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/courses/settings.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/courses/urls.py b/erica_snider/Assignments/Python/Django/courses/courses/urls.py
new file mode 100644
index 0000000..0c01dfb
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/courses/urls.py
@@ -0,0 +1,21 @@
+"""courses URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/1.10/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.conf.urls import url, include
+ 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
+"""
+from django.conf.urls import url, include
+# from django.contrib import admin
+
+urlpatterns = [
+ url(r'^', include('apps.courses_app.urls')),
+]
diff --git a/erica_snider/Assignments/Python/Django/courses/courses/urls.pyc b/erica_snider/Assignments/Python/Django/courses/courses/urls.pyc
new file mode 100644
index 0000000..85f1492
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/courses/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/courses/wsgi.py b/erica_snider/Assignments/Python/Django/courses/courses/wsgi.py
new file mode 100644
index 0000000..9da3dff
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/courses/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for courses 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/1.10/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "courses.settings")
+
+application = get_wsgi_application()
diff --git a/erica_snider/Assignments/Python/Django/courses/courses/wsgi.pyc b/erica_snider/Assignments/Python/Django/courses/courses/wsgi.pyc
new file mode 100644
index 0000000..fd6f9ff
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/courses/wsgi.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/courses/db.sqlite3 b/erica_snider/Assignments/Python/Django/courses/db.sqlite3
new file mode 100644
index 0000000..cf87025
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/courses/db.sqlite3 differ
diff --git a/erica_snider/Assignments/Python/Django/courses/manage.py b/erica_snider/Assignments/Python/Django/courses/manage.py
new file mode 100755
index 0000000..7594c9c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/courses/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "courses.settings")
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError:
+ # The above import may fail for some other reason. Ensure that the
+ # issue is really that Django is missing to avoid masking other
+ # exceptions on Python 2.
+ try:
+ import django
+ except ImportError:
+ 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?"
+ )
+ raise
+ execute_from_command_line(sys.argv)
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/__init__.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/__init__.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/__init__.pyc
new file mode 100644
index 0000000..b98d559
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/__init__.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/__init__.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/__init__.pyc
new file mode 100644
index 0000000..5f41bef
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/admin.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/admin.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/admin.pyc
new file mode 100644
index 0000000..0babbea
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/apps.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/apps.py
new file mode 100644
index 0000000..cf32531
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class DojoSecretsConfig(AppConfig):
+ name = 'dojo_secrets'
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0001_initial.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0001_initial.py
new file mode 100644
index 0000000..5cb8f70
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0001_initial.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-03-20 17:41
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Secret',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('text', models.TextField()),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('updated_at', models.DateTimeField(auto_now_add=True)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='User',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('first_name', models.CharField(max_length=45)),
+ ('last_name', models.CharField(max_length=45)),
+ ('email', models.CharField(max_length=128)),
+ ('password', models.CharField(max_length=256)),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('updated_at', models.DateTimeField(auto_now_add=True)),
+ ],
+ ),
+ migrations.AddField(
+ model_name='secret',
+ name='creator',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='my_secrets', to='dojo_secrets.User'),
+ ),
+ migrations.AddField(
+ model_name='secret',
+ name='likes',
+ field=models.ManyToManyField(related_name='liked_secrets', to='dojo_secrets.User'),
+ ),
+ ]
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0001_initial.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0001_initial.pyc
new file mode 100644
index 0000000..0f56dec
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0001_initial.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0002_auto_20170320_1743.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0002_auto_20170320_1743.py
new file mode 100644
index 0000000..00a678f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0002_auto_20170320_1743.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-03-20 17:43
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('dojo_secrets', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='secret',
+ old_name='text',
+ new_name='secret',
+ ),
+ ]
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0002_auto_20170320_1743.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0002_auto_20170320_1743.pyc
new file mode 100644
index 0000000..228bda3
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/0002_auto_20170320_1743.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/__init__.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/__init__.pyc
new file mode 100644
index 0000000..3aeb906
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/models.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/models.py
new file mode 100644
index 0000000..8604bbf
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/models.py
@@ -0,0 +1,146 @@
+from __future__ import unicode_literals
+from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
+from django.db import models
+from django.db.models import Count
+from django.db import connection
+
+import re, bcrypt
+EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
+
+class UserManager(models.Manager):
+
+ def register(self, postData):
+ errors = []
+ # VALIDATE FIRST NAME
+ if len(postData['first_name']) < 1:
+ errors.append('First name cannot be empty.')
+ elif len(postData['first_name']) <= 2:
+ errors.append('First name must be at least two characters.')
+ # VALIDATE LAST NAME
+ if len(postData['last_name']) < 1:
+ errors.append('Last name cannot be empty.')
+ elif len(postData['last_name']) <= 2:
+ errors.append('Last name must be at least two characters.')
+ # VALIDATE EMAIL
+ if len(postData['email']) < 1:
+ errors.append('Email cannot be empty')
+ elif not EMAIL_REGEX.match(postData['email']):
+ errors.append("Email address must be valid.")
+ else:
+ try:
+ user = User.objects.get(email=postData['email'])
+ except MultipleObjectsReturned:
+ errors.append("Email address has already been registered.")
+ except:
+ pass
+ # VALIDATE PASSWORD
+ if len(postData['password']) < 1:
+ errors.append("Password cannot be empty.")
+ elif len(postData['password']) < 8:
+ errors.append("Password must be at least 8 characters.")
+ # VALIDATE PASSWORD CONFIRMATION
+ if postData['password'] != postData['password_conf']:
+ errors.append("Passwords must match.")
+
+ if len(errors) > 0:
+ return (False, errors)
+ else:
+ #ORM query to create
+ hashed = bcrypt.hashpw(postData['password'].encode(), bcrypt.gensalt()) # creates hashed password to be saved in db
+ new_user = User.objects.create(first_name=postData['first_name'], last_name=postData['last_name'], email=postData['email'], password=hashed)
+ # new_user.save()
+ print 'the newly registered user is', new_user
+ return (True, new_user.id, new_user.first_name) # new_user.first_name
+
+ def login(self, postData):
+ errors = []
+ # VALIDATE EMAIL
+ if len(postData['email']) < 1:
+ errors.append('Email cannot be empty')
+ elif not EMAIL_REGEX.match(postData['email']):
+ errors.append("Email address must be valid.")
+ # VALIDATE PASSWORD
+ if len(postData['password']) < 1:
+ errors.append("Password cannot be empty.")
+ elif len(postData['password']) < 8:
+ errors.append("Password must be at least 8 characters.")
+
+ if len(errors) > 0:
+ return (False, errors)
+ else:
+ try:
+ user = User.objects.get(email=postData['email'])
+ if user.password == bcrypt.hashpw(postData['password'].encode(), user.password.encode()):
+ print 'logging in user is ', user
+ return (True, user.id, user.first_name) # user.first_name
+ else:
+ errors.append("Email or password is invalid. (password doesn't match)")
+ return (False, errors)
+ except ObjectDoesNotExist:
+ errors.append("Email or password is invalid. (email not found)")
+ return (False, errors)
+ except MultipleObjectsReturned:
+ errors.append("Email or password is invalid. (more than one entry with that email)")
+ return (False, errors)
+ # if user.password == bcrypt.hashpw(postData['password'].encode(), user.password.encode()):
+ # return (True, user) # user.first_name
+ # else:
+ # errors.append("Email or password is invalid. (password doesn't match)")
+ # return (False, errors)
+
+
+
+class SecretManager(models.Manager):
+ def secrets_recent(self):
+ # secrets = Secret.objects.annotate(Count('likes')).order_by('-created_at')[:10]
+ # print Secret.objects.annotate(Count('likes')).order_by('-created_at')[:10].query
+ secrets = Secret.objects.order_by('-created_at').annotate(Count('likes'))[:10]
+ print Secret.objects.all()[:10].query
+ print 'the secrets_recent return is ', secrets
+ return (True, secrets)
+
+ def secrets_popular(self):
+ secrets = Secret.objects.annotate(Count('likes')).order_by('-likes__count')[:10]
+ return (True, secrets)
+
+ def create_secret(self, postData):
+ errors=[]
+ if len(postData.POST['secret']) < 1:
+ errors.append('Secret cannot be empty.')
+ return (False, errors)
+ new_secret_creator = User.objects.get(id=postData.session['id'])
+ secret = Secret.objects.create(secret=postData.POST['secret'], creator=new_secret_creator)
+ return (True, secret)
+
+ def create_like(self, postData, secret_id):
+ this_secret = Secret.objects.get(id=secret_id)
+ this_user = User.objects.get(id=postData.session['id'])
+ this_secret.likes.add(this_user)
+ return (True)
+
+ # def created_ago(self):
+ # time_ago = timezone.now() - secret.created_at
+
+
+class User(models.Model):
+ first_name = models.CharField(max_length=45)
+ last_name = models.CharField(max_length=45)
+ email = models.CharField(max_length=128)
+ password = models.CharField(max_length=256)
+ created_at = models.DateTimeField(auto_now_add=True)
+ updated_at = models.DateTimeField(auto_now_add=True)
+ # * my_secrets * (from related_name)
+ # * liked_secrets * (from related_name)
+ def __str__(self):
+ return self.first_name
+ objects = UserManager()
+
+class Secret(models.Model):
+ secret = models.TextField()
+ creator = models.ForeignKey(User, related_name="my_secrets") # creator of the secret; the related name 'psuedo'-creates an array of secrets for each user in the User class (not actually added to database; kept track of by Django and Python)
+ likes = models.ManyToManyField(User, related_name="liked_secrets")
+ created_at = models.DateTimeField(auto_now_add=True)
+ updated_at = models.DateTimeField(auto_now_add=True)
+ def __str__(self):
+ return self.secret
+ objects = SecretManager()
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/models.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/models.pyc
new file mode 100644
index 0000000..277306d
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/templates/dojo_secrets/index.html b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/templates/dojo_secrets/index.html
new file mode 100644
index 0000000..cc5b933
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/templates/dojo_secrets/index.html
@@ -0,0 +1,43 @@
+
+
+
+
+ Dojo Secrets
+
+
+
+
+ {% if 'first_name' in request.session %}
+ Hello, {{request.session.first_name}}
+ {% endif %}
+
+ {% if 'messages' in request.session %}
+ {% for message in request.session.messages %}
+ {{message}}
+ {% endfor %}
+ {% endif %}
+
+
+ Register new user
+
+
+
+ Login
+
+
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/templates/dojo_secrets/secrets.html b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/templates/dojo_secrets/secrets.html
new file mode 100644
index 0000000..46fd45f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/templates/dojo_secrets/secrets.html
@@ -0,0 +1,94 @@
+
+
+
+
+ Dojo Secrets
+
+
+
+ {% if not request.session.logged_in %}
+
+ You must log in.
+
+
+
+ {% else %}
+
+ {% if not request.session.most_popular %}
+
+
+ {% if 'first_name' in request.session %}
+ Hello, {{request.session.first_name}}!
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+ Recent Secrets...
+
+ {{secrets}}
+ {{secrets.0.secret}}
+ {% for each in secrets %}
+ each: {{each.secret}}, timestamp: {{each.created_at}}, likes: {{each.likes__count}}
+
+ {% if each.creator.id == request.session.id %}
+ You wrote this!
+ {% endif %}
+
+ {% if each.likes__user.id == request.session.id %}
+ You liked this
+ {% else %}
+
+
+
+ {% endif %}
+
+ {% endfor %}
+
+ {% else %}
+
+ Most Popular Secrets...
+
+
+
+
+ {% for each in secrets %}
+ each: {{each.secret}}, timestamp: {{each.created_at}}, likes: {{each.likes__count}}
+
+ {% endfor %}
+
+ {% endif %}
+
+ {% endif %}
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/tests.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/urls.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/urls.py
new file mode 100644
index 0000000..950e9ab
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/urls.py
@@ -0,0 +1,16 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index),
+ url(r'^register$', views.register),
+ url(r'^login$', views.login),
+ url(r'^logout$', views.logout),
+ url(r'^secrets$', views.secrets),
+ url(r'^secrets/create$', views.create),
+ url(r'^secrets/(?P\d+)/like$', views.like),
+ url(r'^secrets/(?P\d+)/update$', views.update),
+ url(r'^secrets/(?P\d+)/destroy$', views.destroy),
+ url(r'^secrets/mostpopular$', views.most_popular),
+ url(r'^secrets/formandrecent$', views.form_and_recent),
+]
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/urls.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/urls.pyc
new file mode 100644
index 0000000..21be818
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/views.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/views.py
new file mode 100644
index 0000000..6d2fa89
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/views.py
@@ -0,0 +1,90 @@
+from django.shortcuts import render, redirect
+from .models import User, Secret # in theory, this is not needed here if all model interaction is done in models; try removing
+
+# session is part of the request...
+
+# TO DO: ADD if request.method == 'POST': to post methods
+
+
+def index(request): # GET : RENDER
+ context = request.session
+ return render(request, 'dojo_secrets/index.html', context)
+
+def register(request): # POST : REDIRECT
+ if request.method == 'POST':
+ results = User.objects.register(request.POST) # change parameter to request
+ if results[0] == False:
+ request.session['messages'] = results[1]
+ return redirect('/')
+ elif results[0] == True:
+ print 'the results are', results
+ request.session['logged_in'] = True
+ print 'the id from the result is', results[1]
+ request.session['id'] = results[1]
+ request.session['first_name'] = results[2]
+ request.session['most_popular'] = False
+ return redirect('/secrets')
+ else:
+ request.session['messages'] = "something went wrong"
+ return redirect('/')
+
+def login(request): # POST : REDIRECT
+ if request.method == 'POST':
+ results = User.objects.login(request.POST) # change parameter to request
+ if results[0] == False:
+ request.session['messages'] = results[1]
+ return redirect('/')
+ elif results[0] == True:
+ request.session['logged_in'] = True
+ print 'the id from the result is', results[1]
+ request.session['id'] = results[1]
+ request.session['first_name'] = results[2]
+ request.session['most_popular'] = False
+ return redirect('/secrets')
+ else:
+ request.session['messages'] = "something went wrong"
+ return redirect('/')
+
+def logout(request): # POST : REDIRECT
+ if 'messages' in request.session:
+ request.session.pop('messages')
+ request.session.pop('id')
+ request.session.pop('first_name')
+ request.session['logged_in'] = False
+ return redirect('/')
+
+def secrets(request): # GET : RENDER
+ if not request.session['most_popular']:
+ results = Secret.objects.secrets_recent()
+ print 'the recent secret results are', results[1]
+ else:
+ results = Secret.objects.secrets_popular()
+ context = { 'secrets': results[1] }
+ print 'the secrets.html context is ', context
+ return render(request, 'dojo_secrets/secrets.html', context)
+
+def create(request): # POST : REDIRECT
+ if request.method == 'POST': # good practice!
+ results = Secret.objects.create_secret(request) # request.POST, request.session['id'])
+ return redirect('/secrets')
+
+def like(request, id): # POST : REDIRECT
+ if request.method == 'POST': # good practice!
+ results = Secret.objects.create_like(request, id)
+ return redirect('/secrets')
+
+def update(request): # POST : REDIRECT
+ return redirect('/secrets')
+
+def destroy(request): # POST : REDIRECT
+ return redirect('/secrets')
+
+def most_popular(request):
+ if request.method == 'POST':
+ request.session['most_popular'] = True
+ return redirect('/secrets')
+
+def form_and_recent(request):
+ if request.method == 'POST':
+ request.session['most_popular'] = False
+ return redirect('/secrets')
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/views.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/views.pyc
new file mode 100644
index 0000000..33cd7bc
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/apps/dojo_secrets/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/db.sqlite3 b/erica_snider/Assignments/Python/Django/dojo_secrets_project/db.sqlite3
new file mode 100644
index 0000000..48b26e6
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/db.sqlite3 differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/__init__.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/__init__.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/__init__.pyc
new file mode 100644
index 0000000..8679d5c
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/settings.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/settings.py
new file mode 100644
index 0000000..70cbf34
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/settings.py
@@ -0,0 +1,121 @@
+"""
+Django settings for dojo_secrets_project project.
+
+Generated by 'django-admin startproject' using Django 1.10.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.10/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.10/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'k@3t#1i1_lie7ngk8!mooanojb+#!$v_zaosizdfv&1fikl94f'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'apps.dojo_secrets',
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+]
+
+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 = 'dojo_secrets_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 = 'dojo_secrets_project.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.10/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/1.10/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.10/howto/static-files/
+
+STATIC_URL = '/static/'
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/settings.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/settings.pyc
new file mode 100644
index 0000000..a197ff8
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/settings.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/urls.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/urls.py
new file mode 100644
index 0000000..4021f60
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/urls.py
@@ -0,0 +1,22 @@
+"""dojo_secrets_project URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/1.10/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.conf.urls import url, include
+ 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
+"""
+from django.conf.urls import url, include
+# from django.contrib import admin
+
+urlpatterns = [
+ # url(r'^admin/', admin.site.urls),
+ url(r'^', include('apps.dojo_secrets.urls')),
+]
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/urls.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/urls.pyc
new file mode 100644
index 0000000..15bca6b
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/wsgi.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/wsgi.py
new file mode 100644
index 0000000..bb12331
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for dojo_secrets_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/1.10/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dojo_secrets_project.settings")
+
+application = get_wsgi_application()
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/wsgi.pyc b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/wsgi.pyc
new file mode 100644
index 0000000..7299516
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/dojo_secrets_project/dojo_secrets_project/wsgi.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/dojo_secrets_project/manage.py b/erica_snider/Assignments/Python/Django/dojo_secrets_project/manage.py
new file mode 100755
index 0000000..d12471a
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/dojo_secrets_project/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dojo_secrets_project.settings")
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError:
+ # The above import may fail for some other reason. Ensure that the
+ # issue is really that Django is missing to avoid masking other
+ # exceptions on Python 2.
+ try:
+ import django
+ except ImportError:
+ 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?"
+ )
+ raise
+ execute_from_command_line(sys.argv)
diff --git a/erica_snider/Assignments/Python/Django/empty_assignment.txt b/erica_snider/Assignments/Python/Django/empty_assignment.txt
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/__init__.py b/erica_snider/Assignments/Python/Django/integration_project/apps/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/__init__.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/__init__.pyc
new file mode 100644
index 0000000..fc9f79e
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/__init__.py b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/__init__.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/__init__.pyc
new file mode 100644
index 0000000..428f6f9
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/admin.py b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/admin.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/admin.pyc
new file mode 100644
index 0000000..eb903d4
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/apps.py b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/apps.py
new file mode 100644
index 0000000..4cfa704
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class CoursesAppConfig(AppConfig):
+ name = 'courses_app'
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/migrations/0001_initial.py b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/migrations/0001_initial.py
new file mode 100644
index 0000000..aed5cdf
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/migrations/0001_initial.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-03-18 16:49
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Course',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=255)),
+ ('description', models.TextField(max_length=1000)),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('updated_at', models.DateTimeField(auto_now=True)),
+ ],
+ ),
+ ]
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/migrations/0001_initial.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/migrations/0001_initial.pyc
new file mode 100644
index 0000000..5be89dd
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/migrations/0001_initial.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/migrations/__init__.py b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/migrations/__init__.pyc
new file mode 100644
index 0000000..b218ba7
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/models.py b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/models.py
new file mode 100644
index 0000000..2bf2410
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/models.py
@@ -0,0 +1,10 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+# Create your models here.
+class Course(models.Model):
+ name = models.CharField(max_length=255)
+ description = models.TextField(max_length=1000)
+ created_at = models.DateTimeField(auto_now_add = True)
+ updated_at = models.DateTimeField(auto_now = True)
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/models.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/models.pyc
new file mode 100644
index 0000000..52c5f2d
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/templates/destroy.html b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/templates/destroy.html
new file mode 100644
index 0000000..0db8504
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/templates/destroy.html
@@ -0,0 +1,20 @@
+
+
+
+
+ Destroy?
+
+
+ Are you sure you want to delete the following course?
+ Name: {{course.name}}
+ Description: {{course.description}}
+
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/templates/index.html b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/templates/index.html
new file mode 100644
index 0000000..1124981
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/templates/index.html
@@ -0,0 +1,42 @@
+
+
+
+
+ Courses
+
+
+ Add a new course
+
+
+ Courses
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/tests.py b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/urls.py b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/urls.py
new file mode 100644
index 0000000..9df671e
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/urls.py
@@ -0,0 +1,9 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index),
+ url(r'^courses/add$', views.add),
+ url(r'^courses/destroy/(?P\d+)$', views.destroy),
+ url(r'^courses/delete/(?P\d+)$', views.delete),
+]
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/urls.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/urls.pyc
new file mode 100644
index 0000000..dff635c
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/views.py b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/views.py
new file mode 100644
index 0000000..461b989
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/views.py
@@ -0,0 +1,35 @@
+from django.shortcuts import render, redirect
+from .models import Course
+
+# url METHOD METHOD DIRECTION
+# / def index (show form and data) render template index.html
+# #/courses/add/validate def validate redirect(/add)
+# /courses/add def add (add to db) redirect(/)
+# /courses/destroy/ def destroy render template destroy.html
+# /courses/delete/ def delete redirect(/)
+
+def index(request):
+ context = {
+ "courses": Course.objects.all(),
+ }
+ return render(request, 'index.html', context)
+
+# ADD VALIDATION - here, or in models?...
+# def useradd(request):
+# return redirect('/add')
+
+def add(request):
+ name = request.POST['name']
+ description = request.POST['description']
+ Course.objects.create(name=name, description=description)
+ return redirect('/')
+
+
+def destroy(request, id):
+ course = Course.objects.get(id=id)
+ context = {'course':course}
+ return render(request, 'destroy.html', context)
+
+def delete(request, id):
+ Course.objects.filter(id=id).delete()
+ return redirect('/')
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/views.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/views.pyc
new file mode 100644
index 0000000..8adf75f
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/courses_app/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/__init__.py b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/__init__.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/__init__.pyc
new file mode 100644
index 0000000..ece18f7
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/admin.py b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/admin.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/admin.pyc
new file mode 100644
index 0000000..505694f
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/apps.py b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/apps.py
new file mode 100644
index 0000000..20eaa89
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class LoginAndRegConfig(AppConfig):
+ name = 'login_and_reg'
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/migrations/0001_initial.py b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/migrations/0001_initial.py
new file mode 100644
index 0000000..3bb7856
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/migrations/0001_initial.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-03-19 00:20
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='User',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('first_name', models.CharField(max_length=45)),
+ ('last_name', models.CharField(max_length=45)),
+ ('email', models.CharField(max_length=45)),
+ ('password', models.CharField(max_length=255)),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('updated_at', models.DateTimeField(auto_now=True)),
+ ],
+ ),
+ ]
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/migrations/0001_initial.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/migrations/0001_initial.pyc
new file mode 100644
index 0000000..95ed94e
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/migrations/0001_initial.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/migrations/__init__.py b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/migrations/__init__.pyc
new file mode 100644
index 0000000..6c7bda7
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/models.py b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/models.py
new file mode 100644
index 0000000..9fb15bb
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/models.py
@@ -0,0 +1,94 @@
+from __future__ import unicode_literals
+from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
+from django.db import models
+
+import re, bcrypt
+EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
+# password = "super secret password"
+
+
+class UserManager(models.Manager):
+
+ def register(self, postData):
+ errors = []
+ # VALIDATE FIRST NAME
+ if len(postData['first_name']) < 1:
+ errors.append('First name cannot be empty.')
+ elif len(postData['first_name']) <= 2:
+ errors.append('First name must be at least two characters.')
+ # VALIDATE LAST NAME
+ if len(postData['last_name']) < 1:
+ errors.append('Last name cannot be empty.')
+ elif len(postData['last_name']) <= 2:
+ errors.append('Last name must be at least two characters.')
+ # VALIDATE EMAIL
+ if len(postData['email']) < 1:
+ errors.append('Email cannot be empty')
+ elif not EMAIL_REGEX.match(postData['email']):
+ errors.append("Email address must be valid.")
+ else:
+ try:
+ user = User.objects.get(email=postData['email'])
+ except MultipleObjectsReturned:
+ errors.append("Email address has already been registered.")
+ except:
+ pass
+ # VALIDATE PASSWORD
+ if len(postData['password']) < 1:
+ errors.append("Password cannot be empty.")
+ elif len(postData['password']) < 8:
+ errors.append("Password must be at least 8 characters.")
+ # VALIDATE PASSWORD CONFIRMATION
+ if postData['password'] != postData['password_conf']:
+ errors.append("Passwords must match.")
+
+ if len(errors) > 0:
+ return (False, errors)
+ else:
+ #ORM query to create
+ hashed = bcrypt.hashpw(postData['password'].encode(), bcrypt.gensalt()) # creates hashed password to be saved in db
+ new_user = User.objects.create(first_name=postData['first_name'], last_name=postData['last_name'], email=postData['email'], password=hashed)
+ # new_user.save()
+ print 'the new user is', new_user
+ return (True, new_user.first_name)
+
+
+ def login(self, postData):
+ errors = []
+ # VALIDATE EMAIL
+ if len(postData['email']) < 1:
+ errors.append('Email cannot be empty')
+ elif not EMAIL_REGEX.match(postData['email']):
+ errors.append("Email address must be valid.")
+ # VALIDATE PASSWORD
+ if len(postData['password']) < 1:
+ errors.append("Password cannot be empty.")
+ elif len(postData['password']) < 8:
+ errors.append("Password must be at least 8 characters.")
+
+ if len(errors) > 0:
+ return (False, errors)
+ else:
+ try:
+ user = User.objects.get(email=postData['email'])
+ except ObjectDoesNotExist:
+ errors.append("Email or password is invalid. (email not found)")
+ return (False, errors)
+ except MultipleObjectsReturned:
+ errors.append("Email or password is invalid. (more than one entry with that email)")
+ return (False, errors)
+ if user.password == bcrypt.hashpw(postData['password'].encode(), user.password.encode()):
+ return (True, user.first_name)
+ else:
+ errors.append("Email or password is invalid. (password doesn't match)")
+ return (False, errors)
+
+
+class User(models.Model):
+ first_name = models.CharField(max_length=45)
+ last_name = models.CharField(max_length=45)
+ email = models.CharField(max_length=45)
+ password = models.CharField(max_length=255)
+ created_at = models.DateTimeField(auto_now_add = True)
+ updated_at = models.DateTimeField(auto_now = True)
+ objects = UserManager()
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/models.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/models.pyc
new file mode 100644
index 0000000..607945d
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/templates/index.html b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/templates/index.html
new file mode 100644
index 0000000..f2a88a2
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/templates/index.html
@@ -0,0 +1,42 @@
+
+
+ Welcome
+
+
+
+
+ {% if 'user' in request.session %}
+ Hello, {{request.session.user}}
+ {% endif %}
+
+ {% if 'messages' in request.session %}
+ {% for message in request.session.messages %}
+ {{message}}
+ {% endfor %}
+ {% endif %}
+
+
+ Register new user
+
+
+
+ Login
+
+
+
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/templates/success.html b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/templates/success.html
new file mode 100644
index 0000000..94fa001
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/templates/success.html
@@ -0,0 +1,23 @@
+
+
+ Logged in
+
+
+
+
+ {% if 'user' in request.session %}
+ Hello, {{request.session.user}}
+ {% endif %}
+
+
+ Congrats, you're logged in!
+
+
+
+
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/tests.py b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/urls.py b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/urls.py
new file mode 100644
index 0000000..dfff62f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/urls.py
@@ -0,0 +1,10 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index),
+ url(r'^register$', views.register),
+ url(r'^login$', views.login),
+ url(r'^success$', views.success),
+ url(r'^logout$', views.logout),
+]
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/urls.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/urls.pyc
new file mode 100644
index 0000000..5374055
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/views.py b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/views.py
new file mode 100644
index 0000000..8f7a57a
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/views.py
@@ -0,0 +1,48 @@
+from django.shortcuts import render, redirect
+from .models import User
+
+# request.session:
+ # messages: any errors or feedback to users
+ # logged_in: true or false
+ # user: first name of logged in user
+
+
+def index(request): # GET : RENDER
+ context = request.session
+ return render(request, 'index.html', context)
+
+def register(request): # POST : REDIRECT
+ results = User.objects.register(request.POST)
+ if results[0] == False:
+ request.session['messages'] = results[1]
+ return redirect('/')
+ elif results[0] == True:
+ request.session['logged_in'] = True
+ request.session['user'] = results[1]
+ return redirect('/success')
+ else:
+ request.session['messages'] = "something went wrong"
+ return redirect('/')
+
+def login(request): # POST : REDIRECT
+ results = User.objects.login(request.POST)
+ if results[0] == False:
+ request.session['messages'] = results[1]
+ return redirect('/')
+ elif results[0] == True:
+ request.session['logged_in'] = True
+ request.session['user'] = results[1]
+ return redirect('/success')
+ else:
+ request.session['messages'] = "something went wrong"
+ return redirect('/')
+
+def success(request): # GET : RENDER
+ return render(request, 'success.html')
+
+def logout(request): # POST : REDIRECT
+ request.session.pop('user')
+ if 'messages' in request.session:
+ request.session.pop('messages')
+ request.session['logged_in'] = False
+ return redirect('/')
diff --git a/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/views.pyc b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/views.pyc
new file mode 100644
index 0000000..0b19e14
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/apps/login_and_reg/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/db.sqlite3 b/erica_snider/Assignments/Python/Django/integration_project/db.sqlite3
new file mode 100644
index 0000000..b6e3290
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/db.sqlite3 differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/integration_project/__init__.py b/erica_snider/Assignments/Python/Django/integration_project/integration_project/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/integration_project/integration_project/__init__.pyc b/erica_snider/Assignments/Python/Django/integration_project/integration_project/__init__.pyc
new file mode 100644
index 0000000..8fc2e30
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/integration_project/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/integration_project/settings.py b/erica_snider/Assignments/Python/Django/integration_project/integration_project/settings.py
new file mode 100644
index 0000000..0061c60
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/integration_project/settings.py
@@ -0,0 +1,122 @@
+"""
+Django settings for integration_project project.
+
+Generated by 'django-admin startproject' using Django 1.10.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.10/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.10/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = '0edu!v3l=e$_4h6)6a2#q6)vk4jyqvprw-s@hh5hcp=ggw=xy*'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'apps.courses_app',
+ 'apps.login_and_reg',
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+]
+
+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 = 'integration_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 = 'integration_project.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.10/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/1.10/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.10/howto/static-files/
+
+STATIC_URL = '/static/'
diff --git a/erica_snider/Assignments/Python/Django/integration_project/integration_project/settings.pyc b/erica_snider/Assignments/Python/Django/integration_project/integration_project/settings.pyc
new file mode 100644
index 0000000..00bbd51
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/integration_project/settings.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/integration_project/urls.py b/erica_snider/Assignments/Python/Django/integration_project/integration_project/urls.py
new file mode 100644
index 0000000..8e3917f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/integration_project/urls.py
@@ -0,0 +1,23 @@
+"""integration_project URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/1.10/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.conf.urls import url, include
+ 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
+"""
+from django.conf.urls import url, include
+# from django.contrib import admin
+
+urlpatterns = [
+ # url(r'^admin/', admin.site.urls),
+ url(r'^loginandreg/', include('apps.login_and_reg.urls')),
+ url(r'^courses/', include('apps.courses_app.urls')),
+]
diff --git a/erica_snider/Assignments/Python/Django/integration_project/integration_project/urls.pyc b/erica_snider/Assignments/Python/Django/integration_project/integration_project/urls.pyc
new file mode 100644
index 0000000..63ca882
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/integration_project/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/integration_project/wsgi.py b/erica_snider/Assignments/Python/Django/integration_project/integration_project/wsgi.py
new file mode 100644
index 0000000..b68a3eb
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/integration_project/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for integration_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/1.10/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "integration_project.settings")
+
+application = get_wsgi_application()
diff --git a/erica_snider/Assignments/Python/Django/integration_project/integration_project/wsgi.pyc b/erica_snider/Assignments/Python/Django/integration_project/integration_project/wsgi.pyc
new file mode 100644
index 0000000..5a631d5
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/integration_project/integration_project/wsgi.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/integration_project/manage.py b/erica_snider/Assignments/Python/Django/integration_project/manage.py
new file mode 100755
index 0000000..99a559a
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/integration_project/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "integration_project.settings")
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError:
+ # The above import may fail for some other reason. Ensure that the
+ # issue is really that Django is missing to avoid masking other
+ # exceptions on Python 2.
+ try:
+ import django
+ except ImportError:
+ 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?"
+ )
+ raise
+ execute_from_command_line(sys.argv)
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/__init__.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/__init__.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/__init__.pyc
new file mode 100644
index 0000000..43cdd59
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/__init__.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/__init__.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/__init__.pyc
new file mode 100644
index 0000000..9c12af5
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/admin.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/admin.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/admin.pyc
new file mode 100644
index 0000000..bcabf0a
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/apps.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/apps.py
new file mode 100644
index 0000000..20eaa89
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class LoginAndRegConfig(AppConfig):
+ name = 'login_and_reg'
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/migrations/0001_initial.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/migrations/0001_initial.py
new file mode 100644
index 0000000..3bb7856
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/migrations/0001_initial.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-03-19 00:20
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='User',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('first_name', models.CharField(max_length=45)),
+ ('last_name', models.CharField(max_length=45)),
+ ('email', models.CharField(max_length=45)),
+ ('password', models.CharField(max_length=255)),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('updated_at', models.DateTimeField(auto_now=True)),
+ ],
+ ),
+ ]
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/migrations/0001_initial.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/migrations/0001_initial.pyc
new file mode 100644
index 0000000..d8e69a4
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/migrations/0001_initial.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/migrations/__init__.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/migrations/__init__.pyc
new file mode 100644
index 0000000..ded3787
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/models.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/models.py
new file mode 100644
index 0000000..9fb15bb
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/models.py
@@ -0,0 +1,94 @@
+from __future__ import unicode_literals
+from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
+from django.db import models
+
+import re, bcrypt
+EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
+# password = "super secret password"
+
+
+class UserManager(models.Manager):
+
+ def register(self, postData):
+ errors = []
+ # VALIDATE FIRST NAME
+ if len(postData['first_name']) < 1:
+ errors.append('First name cannot be empty.')
+ elif len(postData['first_name']) <= 2:
+ errors.append('First name must be at least two characters.')
+ # VALIDATE LAST NAME
+ if len(postData['last_name']) < 1:
+ errors.append('Last name cannot be empty.')
+ elif len(postData['last_name']) <= 2:
+ errors.append('Last name must be at least two characters.')
+ # VALIDATE EMAIL
+ if len(postData['email']) < 1:
+ errors.append('Email cannot be empty')
+ elif not EMAIL_REGEX.match(postData['email']):
+ errors.append("Email address must be valid.")
+ else:
+ try:
+ user = User.objects.get(email=postData['email'])
+ except MultipleObjectsReturned:
+ errors.append("Email address has already been registered.")
+ except:
+ pass
+ # VALIDATE PASSWORD
+ if len(postData['password']) < 1:
+ errors.append("Password cannot be empty.")
+ elif len(postData['password']) < 8:
+ errors.append("Password must be at least 8 characters.")
+ # VALIDATE PASSWORD CONFIRMATION
+ if postData['password'] != postData['password_conf']:
+ errors.append("Passwords must match.")
+
+ if len(errors) > 0:
+ return (False, errors)
+ else:
+ #ORM query to create
+ hashed = bcrypt.hashpw(postData['password'].encode(), bcrypt.gensalt()) # creates hashed password to be saved in db
+ new_user = User.objects.create(first_name=postData['first_name'], last_name=postData['last_name'], email=postData['email'], password=hashed)
+ # new_user.save()
+ print 'the new user is', new_user
+ return (True, new_user.first_name)
+
+
+ def login(self, postData):
+ errors = []
+ # VALIDATE EMAIL
+ if len(postData['email']) < 1:
+ errors.append('Email cannot be empty')
+ elif not EMAIL_REGEX.match(postData['email']):
+ errors.append("Email address must be valid.")
+ # VALIDATE PASSWORD
+ if len(postData['password']) < 1:
+ errors.append("Password cannot be empty.")
+ elif len(postData['password']) < 8:
+ errors.append("Password must be at least 8 characters.")
+
+ if len(errors) > 0:
+ return (False, errors)
+ else:
+ try:
+ user = User.objects.get(email=postData['email'])
+ except ObjectDoesNotExist:
+ errors.append("Email or password is invalid. (email not found)")
+ return (False, errors)
+ except MultipleObjectsReturned:
+ errors.append("Email or password is invalid. (more than one entry with that email)")
+ return (False, errors)
+ if user.password == bcrypt.hashpw(postData['password'].encode(), user.password.encode()):
+ return (True, user.first_name)
+ else:
+ errors.append("Email or password is invalid. (password doesn't match)")
+ return (False, errors)
+
+
+class User(models.Model):
+ first_name = models.CharField(max_length=45)
+ last_name = models.CharField(max_length=45)
+ email = models.CharField(max_length=45)
+ password = models.CharField(max_length=255)
+ created_at = models.DateTimeField(auto_now_add = True)
+ updated_at = models.DateTimeField(auto_now = True)
+ objects = UserManager()
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/models.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/models.pyc
new file mode 100644
index 0000000..58e957e
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/templates/index.html b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/templates/index.html
new file mode 100644
index 0000000..f2a88a2
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/templates/index.html
@@ -0,0 +1,42 @@
+
+
+ Welcome
+
+
+
+
+ {% if 'user' in request.session %}
+ Hello, {{request.session.user}}
+ {% endif %}
+
+ {% if 'messages' in request.session %}
+ {% for message in request.session.messages %}
+ {{message}}
+ {% endfor %}
+ {% endif %}
+
+
+ Register new user
+
+
+
+ Login
+
+
+
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/templates/success.html b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/templates/success.html
new file mode 100644
index 0000000..94fa001
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/templates/success.html
@@ -0,0 +1,23 @@
+
+
+ Logged in
+
+
+
+
+ {% if 'user' in request.session %}
+ Hello, {{request.session.user}}
+ {% endif %}
+
+
+ Congrats, you're logged in!
+
+
+
+
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/tests.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/urls.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/urls.py
new file mode 100644
index 0000000..dfff62f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/urls.py
@@ -0,0 +1,10 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index),
+ url(r'^register$', views.register),
+ url(r'^login$', views.login),
+ url(r'^success$', views.success),
+ url(r'^logout$', views.logout),
+]
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/urls.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/urls.pyc
new file mode 100644
index 0000000..2c84778
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/views.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/views.py
new file mode 100644
index 0000000..8f7a57a
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/views.py
@@ -0,0 +1,48 @@
+from django.shortcuts import render, redirect
+from .models import User
+
+# request.session:
+ # messages: any errors or feedback to users
+ # logged_in: true or false
+ # user: first name of logged in user
+
+
+def index(request): # GET : RENDER
+ context = request.session
+ return render(request, 'index.html', context)
+
+def register(request): # POST : REDIRECT
+ results = User.objects.register(request.POST)
+ if results[0] == False:
+ request.session['messages'] = results[1]
+ return redirect('/')
+ elif results[0] == True:
+ request.session['logged_in'] = True
+ request.session['user'] = results[1]
+ return redirect('/success')
+ else:
+ request.session['messages'] = "something went wrong"
+ return redirect('/')
+
+def login(request): # POST : REDIRECT
+ results = User.objects.login(request.POST)
+ if results[0] == False:
+ request.session['messages'] = results[1]
+ return redirect('/')
+ elif results[0] == True:
+ request.session['logged_in'] = True
+ request.session['user'] = results[1]
+ return redirect('/success')
+ else:
+ request.session['messages'] = "something went wrong"
+ return redirect('/')
+
+def success(request): # GET : RENDER
+ return render(request, 'success.html')
+
+def logout(request): # POST : REDIRECT
+ request.session.pop('user')
+ if 'messages' in request.session:
+ request.session.pop('messages')
+ request.session['logged_in'] = False
+ return redirect('/')
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/views.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/views.pyc
new file mode 100644
index 0000000..22b6bd4
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/apps/login_and_reg/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/db.sqlite3 b/erica_snider/Assignments/Python/Django/login_and_reg_django/db.sqlite3
new file mode 100644
index 0000000..5d67ead
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/db.sqlite3 differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/__init__.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/__init__.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/__init__.pyc
new file mode 100644
index 0000000..3a60eb9
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/settings.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/settings.py
new file mode 100644
index 0000000..c23aa78
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/settings.py
@@ -0,0 +1,121 @@
+"""
+Django settings for login_and_reg_django project.
+
+Generated by 'django-admin startproject' using Django 1.10.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.10/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.10/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'l$s2$zs_#%(ch_clpx6sx86nfm98yr1_i9)6)_ezlz8++t%9-b'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'apps.login_and_reg',
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+]
+
+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 = 'login_and_reg_django.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 = 'login_and_reg_django.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.10/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/1.10/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.10/howto/static-files/
+
+STATIC_URL = '/static/'
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/settings.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/settings.pyc
new file mode 100644
index 0000000..ad5303e
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/settings.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/urls.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/urls.py
new file mode 100644
index 0000000..6628d69
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/urls.py
@@ -0,0 +1,21 @@
+"""login_and_reg_django URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/1.10/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.conf.urls import url, include
+ 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
+"""
+from django.conf.urls import url, include
+# from django.contrib import admin
+
+urlpatterns = [
+ url(r'^', include('apps.login_and_reg.urls')),
+]
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/urls.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/urls.pyc
new file mode 100644
index 0000000..b99f0df
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/wsgi.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/wsgi.py
new file mode 100644
index 0000000..9637fe4
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for login_and_reg_django 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/1.10/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "login_and_reg_django.settings")
+
+application = get_wsgi_application()
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/wsgi.pyc b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/wsgi.pyc
new file mode 100644
index 0000000..73cb3a5
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/login_and_reg_django/login_and_reg_django/wsgi.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/login_and_reg_django/manage.py b/erica_snider/Assignments/Python/Django/login_and_reg_django/manage.py
new file mode 100755
index 0000000..3297494
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/login_and_reg_django/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "login_and_reg_django.settings")
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError:
+ # The above import may fail for some other reason. Ensure that the
+ # issue is really that Django is missing to avoid masking other
+ # exceptions on Python 2.
+ try:
+ import django
+ except ImportError:
+ 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?"
+ )
+ raise
+ execute_from_command_line(sys.argv)
diff --git a/erica_snider/Assignments/Python/Django/main/__init__.py b/erica_snider/Assignments/Python/Django/main/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/__init__.pyc
new file mode 100644
index 0000000..ad76dd7
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/__init__.pyc
new file mode 100644
index 0000000..e4649e3
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/admin.py b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/admin.pyc b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/admin.pyc
new file mode 100644
index 0000000..6a79c20
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/apps.py b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/apps.py
new file mode 100644
index 0000000..113bb1a
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class DisappearingNinjasConfig(AppConfig):
+ name = 'disappearing_ninjas'
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/migrations/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/migrations/__init__.pyc
new file mode 100644
index 0000000..1cac852
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/models.py b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/models.py
new file mode 100644
index 0000000..bd4b2ab
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/models.py
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+# Create your models here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/models.pyc b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/models.pyc
new file mode 100644
index 0000000..3fee0d7
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/donatello.jpg b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/donatello.jpg
new file mode 100755
index 0000000..8912292
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/donatello.jpg differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/leonardo.jpg b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/leonardo.jpg
new file mode 100755
index 0000000..c049cfd
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/leonardo.jpg differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/michelangelo.jpg b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/michelangelo.jpg
new file mode 100755
index 0000000..4ad75d0
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/michelangelo.jpg differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/notapril.jpg b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/notapril.jpg
new file mode 100755
index 0000000..39b2f0a
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/notapril.jpg differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/raphael.jpg b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/raphael.jpg
new file mode 100755
index 0000000..57fb2a3
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/raphael.jpg differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/tmnt.png b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/tmnt.png
new file mode 100644
index 0000000..941c82e
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/static/disappearing_ninjas/images/tmnt.png differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/templates/index.html b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/templates/index.html
new file mode 100644
index 0000000..0f152af
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/templates/index.html
@@ -0,0 +1,8 @@
+
+
+ Disappearing Ninjas
+
+
+ No ninjas here!
+
+
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/templates/ninja.html b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/templates/ninja.html
new file mode 100644
index 0000000..0b889e6
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/templates/ninja.html
@@ -0,0 +1,21 @@
+
+
+ Disappearing Ninjas
+
+
+
+ Ninjas!
+ {{color}}
+ {% if len(color.items) > 1 %}
+ {% for item in color.items %}
+
+
+
+ {% endfor %}
+ {% else %}
+
+ {% endif %}
+
+
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/tests.py b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/urls.py b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/urls.py
new file mode 100644
index 0000000..049d7dd
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/urls.py
@@ -0,0 +1,8 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index),
+ url(r'^ninjas$', views.ninjas),
+ url(r'^ninjas/(?P[\w]+)$', views.specific_ninja)
+]
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/urls.pyc b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/urls.pyc
new file mode 100644
index 0000000..38f9662
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/views.py b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/views.py
new file mode 100644
index 0000000..5da71c9
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/views.py
@@ -0,0 +1,36 @@
+from django.shortcuts import render
+
+# Create your views here.
+def index(request):
+ request.session['ninjas'] = {
+ 'blue': 'donatello.jpg',
+ 'orange': 'michelangelo.jpg',
+ 'red': 'raphael.jpg',
+ 'purple': 'leonardo.jpg'
+ }
+ return render(request, 'index.html')
+
+def ninjas(request):
+ # request.session['color'] = ['blue','orange','red','purple']
+ # print request.session['ninjas']['blue']
+ context = {
+ 'color': request.session['ninjas']
+ }
+
+ return render(request, 'ninja.html', context)
+
+def specific_ninja(request, color):
+ # print request.session['ninjas'][color]
+ print "the color is", color
+ specific_color = request.session['ninjas'][color]
+ print "the specific color is", specific_color
+ context = {
+ 'color': specific_color
+ }
+ print "the context is", context
+ print "the context['color'] is", context['color']
+
+ for item in context['color'].items:
+ print color.items
+
+ return render(request, 'ninja.html', context)
diff --git a/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/views.pyc b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/views.pyc
new file mode 100644
index 0000000..390270f
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/disappearing_ninjas/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/django_email/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/django_email/__init__.pyc
new file mode 100644
index 0000000..e80f988
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/django_email/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/admin.py b/erica_snider/Assignments/Python/Django/main/apps/django_email/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/django_email/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/admin.pyc b/erica_snider/Assignments/Python/Django/main/apps/django_email/admin.pyc
new file mode 100644
index 0000000..c9fa507
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/django_email/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/apps.py b/erica_snider/Assignments/Python/Django/main/apps/django_email/apps.py
new file mode 100644
index 0000000..471c754
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/django_email/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class DjangoEmailConfig(AppConfig):
+ name = 'django_email'
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/migrations/0001_initial.py b/erica_snider/Assignments/Python/Django/main/apps/django_email/migrations/0001_initial.py
new file mode 100644
index 0000000..5027430
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/django_email/migrations/0001_initial.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-03-18 18:49
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Email',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('email', models.CharField(max_length=255)),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('updated_at', models.DateTimeField(auto_now=True)),
+ ],
+ ),
+ ]
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/migrations/0001_initial.pyc b/erica_snider/Assignments/Python/Django/main/apps/django_email/migrations/0001_initial.pyc
new file mode 100644
index 0000000..e8f9f2c
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/django_email/migrations/0001_initial.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/migrations/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/django_email/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/django_email/migrations/__init__.pyc
new file mode 100644
index 0000000..a20c5d3
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/django_email/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/models.py b/erica_snider/Assignments/Python/Django/main/apps/django_email/models.py
new file mode 100644
index 0000000..771cd03
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/django_email/models.py
@@ -0,0 +1,40 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+import re # the "re" module will let us perform some regular expression operations
+EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
+
+class UserManager(models.Manager):
+ def login(self, postData):
+ print "Running a login function!"
+ print "If successful login occurs, maybe return {'theuser':user} where user is a user object?"
+ print "If unsuccessful, maybe return { 'errors':['Login unsuccessful'] }"
+ pass
+ def register(self, postData):
+ print ("Register a user here")
+ print ("If successful, maybe return {'theuser':user} where user is a user object?")
+ print ("If unsuccessful do something like this? return {'errors':['User first name to short', 'Last name too short'] ")
+ pass
+ def validate(self, postData):
+ # print ("Validate the user-supplied email address here")
+ # print ("If successful, maybe return {'theuser':user} where user is a user object?")
+ # print ("If unsuccessful do something like this? return {'errors':['Email not valid']}")
+ if len(postData) < 1:
+ validation = {'errors':['Email cannot be empty']}
+ elif not EMAIL_REGEX.match(postData):
+ validation = {'errors':['Email not valid']}
+ else:
+ validation = {'success':[postData]}
+ # on successful validation, insert email into database and redirect to success page
+ return validation
+
+class Email(models.Model):
+ email = models.CharField(max_length=255)
+ created_at = models.DateTimeField(auto_now_add = True)
+ updated_at = models.DateTimeField(auto_now = True)
+ # *************************
+ # Connect an instance of UserManager to our User model overwriting
+ # the old hidden objects key with a new one with extra properties!!!
+ objects = UserManager()
+ # *************************
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/models.pyc b/erica_snider/Assignments/Python/Django/main/apps/django_email/models.pyc
new file mode 100644
index 0000000..7e40296
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/django_email/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/templates/index.html b/erica_snider/Assignments/Python/Django/main/apps/django_email/templates/index.html
new file mode 100644
index 0000000..898e9c0
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/django_email/templates/index.html
@@ -0,0 +1,19 @@
+
+
+ Email
+
+
+
+ {% if request.session.message != 'null' %}
+ {{request.session.message}}
+ {% endif %}
+
+
+
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/templates/success.html b/erica_snider/Assignments/Python/Django/main/apps/django_email/templates/success.html
new file mode 100644
index 0000000..fd3215b
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/django_email/templates/success.html
@@ -0,0 +1,11 @@
+
+
+ Email
+
+
+ Email addresses entered:
+ {% for email in emails %}
+ {{ email.email }}, {{ email.created_at }}
+ {% endfor %}
+
+
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/tests.py b/erica_snider/Assignments/Python/Django/main/apps/django_email/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/django_email/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/urls.py b/erica_snider/Assignments/Python/Django/main/apps/django_email/urls.py
new file mode 100644
index 0000000..61829be
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/django_email/urls.py
@@ -0,0 +1,8 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index),
+ url(r'^validate$', views.validate),
+ url(r'^success$', views.success)
+]
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/urls.pyc b/erica_snider/Assignments/Python/Django/main/apps/django_email/urls.pyc
new file mode 100644
index 0000000..a2363ae
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/django_email/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/views.py b/erica_snider/Assignments/Python/Django/main/apps/django_email/views.py
new file mode 100644
index 0000000..b4b4b3b
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/django_email/views.py
@@ -0,0 +1,32 @@
+from django.shortcuts import render, redirect
+from .models import Email
+
+# Create your views here.
+def index(request):
+ if 'message' not in request.session:
+ request.session['message'] = "null"
+
+ context = { 'message': request.session['message'] }
+
+ return render(request, 'index.html', context)
+
+def validate(request):
+ email = request.POST['email']
+ validation = Email.objects.validate(email)
+
+ print (type(email))
+
+ if 'errors' in validation:
+ request.session['message'] = validation['errors'][0] #'Email is not valid!' ## validation.errors
+ return redirect('/')
+ elif 'success' in validation:
+ Email.objects.create(email=email)
+ return redirect('/success')
+ else:
+ return alert('error!')
+
+def success(request):
+ emails = Email.objects.all()
+ context = {'emails':emails}
+ print context
+ return render(request, 'success.html', context)
diff --git a/erica_snider/Assignments/Python/Django/main/apps/django_email/views.pyc b/erica_snider/Assignments/Python/Django/main/apps/django_email/views.pyc
new file mode 100644
index 0000000..c771353
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/django_email/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/first_app/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/first_app/__init__.pyc
new file mode 100644
index 0000000..5d15048
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/first_app/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/admin.py b/erica_snider/Assignments/Python/Django/main/apps/first_app/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/first_app/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/admin.pyc b/erica_snider/Assignments/Python/Django/main/apps/first_app/admin.pyc
new file mode 100644
index 0000000..efa3f4f
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/first_app/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/apps.py b/erica_snider/Assignments/Python/Django/main/apps/first_app/apps.py
new file mode 100644
index 0000000..8cf458f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/first_app/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class FirstAppConfig(AppConfig):
+ name = 'first_app'
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/migrations/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/first_app/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/first_app/migrations/__init__.pyc
new file mode 100644
index 0000000..ed38c29
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/first_app/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/models.py b/erica_snider/Assignments/Python/Django/main/apps/first_app/models.py
new file mode 100644
index 0000000..bd4b2ab
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/first_app/models.py
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+# Create your models here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/models.pyc b/erica_snider/Assignments/Python/Django/main/apps/first_app/models.pyc
new file mode 100644
index 0000000..4cf286b
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/first_app/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/templates/first_app/index.html b/erica_snider/Assignments/Python/Django/main/apps/first_app/templates/first_app/index.html
new file mode 100644
index 0000000..dc48d6b
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/first_app/templates/first_app/index.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+ Hello World
+
+
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/tests.py b/erica_snider/Assignments/Python/Django/main/apps/first_app/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/first_app/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/urls.py b/erica_snider/Assignments/Python/Django/main/apps/first_app/urls.py
new file mode 100644
index 0000000..0166957
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/first_app/urls.py
@@ -0,0 +1,24 @@
+from django.conf.urls import url
+from . import views
+
+
+# Models -- views -- TEMPLATES
+
+
+# def method_to_run(request):
+# print "Whatever route that was hit by an HTTP request (by the way) decided to invoke me!"
+# print "By the way, here's the request object that Django automatically passes us:", request
+# print "By the by, we still aren't delivering anything to the browser, so you should see 'ValueError at /'"
+#
+# urlpatterns = [
+# url(r'^$', method_to_run)
+# ]
+
+# same same in Flask:
+# @app.route('/')
+# def method_to_run():
+
+
+urlpatterns = [
+ url(r'^$', views.index)
+]
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/urls.pyc b/erica_snider/Assignments/Python/Django/main/apps/first_app/urls.pyc
new file mode 100644
index 0000000..fcd28b0
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/first_app/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/views.py b/erica_snider/Assignments/Python/Django/main/apps/first_app/views.py
new file mode 100644
index 0000000..ecf090f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/first_app/views.py
@@ -0,0 +1,11 @@
+from django.shortcuts import render
+
+
+# CONTROLLER
+
+
+# Create your views here.
+
+def index(request):
+ print "*"*50
+ return render(request, 'first_app/index.html')
diff --git a/erica_snider/Assignments/Python/Django/main/apps/first_app/views.pyc b/erica_snider/Assignments/Python/Django/main/apps/first_app/views.pyc
new file mode 100644
index 0000000..3819ce8
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/first_app/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/__init__.pyc
new file mode 100644
index 0000000..89b7307
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/admin.py b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/admin.pyc b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/admin.pyc
new file mode 100644
index 0000000..1be44f1
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/apps.py b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/apps.py
new file mode 100644
index 0000000..80c3824
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class NinjaGoldConfig(AppConfig):
+ name = 'ninja_gold'
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/migrations/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/migrations/__init__.pyc
new file mode 100644
index 0000000..8bb096e
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/models.py b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/models.py
new file mode 100644
index 0000000..bd4b2ab
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/models.py
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+# Create your models here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/models.pyc b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/models.pyc
new file mode 100644
index 0000000..0524a28
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/templates/index.html b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/templates/index.html
new file mode 100644
index 0000000..741e66f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/templates/index.html
@@ -0,0 +1,43 @@
+
+
+ Ninja Gold
+
+
+
+
+ Your Gold: {{ request.session.total_gold }}
+
+
+
+
+ Activities:
+ {% for each in request.session.activity_log %}
+ {{ each }}
+ {% endfor %}
+
+
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/tests.py b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/urls.py b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/urls.py
new file mode 100644
index 0000000..008c5de
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/urls.py
@@ -0,0 +1,8 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index),
+ url(r'^process_money$', views.process_money),
+ url(r'^reset', views.reset)
+]
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/urls.pyc b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/urls.pyc
new file mode 100644
index 0000000..e6ae88e
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/views.py b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/views.py
new file mode 100644
index 0000000..2f7d5ea
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/views.py
@@ -0,0 +1,41 @@
+from django.shortcuts import render, redirect
+import random
+
+# Create your views here.
+def index(request):
+ if 'total_gold' not in request.session:
+ request.session['total_gold'] = 0
+ if 'activity_log' not in request.session:
+ request.session['activity_log'] = []
+ return render(request, 'index.html')
+
+def process_money(request):
+ win_lose = 1 # winning gold
+ building = request.POST['building']
+ if building == 'farm':
+ request.session['gold'] = random.randrange(10,21)
+ building = request.POST['building']
+ elif building == 'cave':
+ request.session['gold'] = random.randrange(5,11)
+ elif building == 'house':
+ request.session['gold'] = random.randrange(2,6)
+ elif building == 'casino':
+ request.session['gold'] = random.randrange(0,51)
+ earn_or_take = random.randrange(0,2)
+ if earn_or_take == 0:
+ request.session['gold'] *= -1
+ win_lose = 0 # losing gold
+ print request.session['gold']
+ request.session['total_gold'] += request.session['gold']
+
+ if win_lose == 1:
+ request.session['activity_log'].append("Earned " + str(request.session['gold']) + " golds from the " + building + "!")
+ else:
+ request.session['activity_log'].append("Entered a casino and lost " + str(request.session['gold']*-1) + " golds... Ouch.. ")
+
+ return redirect('/')
+
+def reset(request):
+ request.session.pop('activity_log') # Check on pop in django
+ request.session.pop('total_gold') # Check on pop in django
+ return redirect('/')
diff --git a/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/views.pyc b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/views.pyc
new file mode 100644
index 0000000..945109a
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/ninja_gold/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/survey_form/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/survey_form/__init__.pyc
new file mode 100644
index 0000000..f56c9b5
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/survey_form/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/admin.py b/erica_snider/Assignments/Python/Django/main/apps/survey_form/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/survey_form/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/admin.pyc b/erica_snider/Assignments/Python/Django/main/apps/survey_form/admin.pyc
new file mode 100644
index 0000000..479eefd
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/survey_form/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/apps.py b/erica_snider/Assignments/Python/Django/main/apps/survey_form/apps.py
new file mode 100644
index 0000000..082d595
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/survey_form/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class SurveyFormConfig(AppConfig):
+ name = 'survey_form'
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/migrations/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/survey_form/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/survey_form/migrations/__init__.pyc
new file mode 100644
index 0000000..86ec786
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/survey_form/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/models.py b/erica_snider/Assignments/Python/Django/main/apps/survey_form/models.py
new file mode 100644
index 0000000..bd4b2ab
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/survey_form/models.py
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+# Create your models here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/models.pyc b/erica_snider/Assignments/Python/Django/main/apps/survey_form/models.pyc
new file mode 100644
index 0000000..3bb1024
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/survey_form/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/templates/survey_form/index.html b/erica_snider/Assignments/Python/Django/main/apps/survey_form/templates/survey_form/index.html
new file mode 100644
index 0000000..7a6ba43
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/survey_form/templates/survey_form/index.html
@@ -0,0 +1,25 @@
+
+
+ Survey Index
+
+
+ Survey
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/templates/survey_form/results.html b/erica_snider/Assignments/Python/Django/main/apps/survey_form/templates/survey_form/results.html
new file mode 100644
index 0000000..07c35fd
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/survey_form/templates/survey_form/results.html
@@ -0,0 +1,17 @@
+
+
+ Survey Results
+
+
+ Thanks for submitting this form. You have submitted this form {{ request.session.count }} times.
+ Submitted Information
+ Name: {{ request.session.name }}
+ Location: {{ request.session.location }}
+ Language: {{ request.session.language }}
+ Comment: {{ request.session.comment }}
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/tests.py b/erica_snider/Assignments/Python/Django/main/apps/survey_form/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/survey_form/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/urls.py b/erica_snider/Assignments/Python/Django/main/apps/survey_form/urls.py
new file mode 100644
index 0000000..82bff9f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/survey_form/urls.py
@@ -0,0 +1,9 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index),
+ url(r'^survey/process$', views.process),
+ url(r'^result$', views.results),
+ url(r'^goback$', views.goback)
+]
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/urls.pyc b/erica_snider/Assignments/Python/Django/main/apps/survey_form/urls.pyc
new file mode 100644
index 0000000..c8d4da7
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/survey_form/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/views.py b/erica_snider/Assignments/Python/Django/main/apps/survey_form/views.py
new file mode 100644
index 0000000..1ae6b2d
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/survey_form/views.py
@@ -0,0 +1,24 @@
+from django.shortcuts import render, redirect
+
+def index(request):
+ return render(request, 'survey_form/index.html')
+
+
+def process(request):
+ if 'count' not in request.session:
+ request.session['count'] = 1
+ else:
+ request.session['count'] += 1
+
+ request.session['name'] = request.POST['name']
+ request.session['location'] = request.POST['location']
+ request.session['language'] = request.POST['language']
+ request.session['comment'] = request.POST['comment']
+
+ return redirect('/result')
+
+def results(request):
+ return render(request, 'survey_form/results.html')
+
+def goback(request):
+ return redirect('/')
diff --git a/erica_snider/Assignments/Python/Django/main/apps/survey_form/views.pyc b/erica_snider/Assignments/Python/Django/main/apps/survey_form/views.pyc
new file mode 100644
index 0000000..1b5445a
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/survey_form/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/__init__.pyc
new file mode 100644
index 0000000..8f9adaf
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/admin.py b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/admin.pyc b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/admin.pyc
new file mode 100644
index 0000000..4bed7f8
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/apps.py b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/apps.py
new file mode 100644
index 0000000..851a75d
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class VinmymvcConfig(AppConfig):
+ name = 'vinmyMVC'
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/migrations/__init__.py b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/migrations/__init__.pyc
new file mode 100644
index 0000000..8ad80b1
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/models.py b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/models.py
new file mode 100644
index 0000000..bd4b2ab
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/models.py
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+# Create your models here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/models.pyc b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/models.pyc
new file mode 100644
index 0000000..6e79550
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/templates/vinmyMVC/index.html b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/templates/vinmyMVC/index.html
new file mode 100644
index 0000000..35157cd
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/templates/vinmyMVC/index.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+ Index Html Yay!
+
+
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/templates/vinmyMVC/show_users.html b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/templates/vinmyMVC/show_users.html
new file mode 100644
index 0000000..5ff09b5
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/templates/vinmyMVC/show_users.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+ showing users kinda
+
+
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/tests.py b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/urls.py b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/urls.py
new file mode 100644
index 0000000..d1982bb
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/urls.py
@@ -0,0 +1,7 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [ # I screwed ths up ...
+ url(r'^$', views.index),
+ url(r'^show/$', views.show)
+]
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/urls.pyc b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/urls.pyc
new file mode 100644
index 0000000..af0a682
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/views.py b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/views.py
new file mode 100644
index 0000000..d02fab2
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/views.py
@@ -0,0 +1,9 @@
+from django.shortcuts import render
+
+# Create your views here.
+def index(request):
+ return render(request, 'vinmyMVC/index.html')
+
+def show(request):
+ print(request.method)
+ return render(request, 'vinmyMVC/show_users.html')
diff --git a/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/views.pyc b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/views.pyc
new file mode 100644
index 0000000..96712ca
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/apps/vinmyMVC/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/db.sqlite3 b/erica_snider/Assignments/Python/Django/main/db.sqlite3
new file mode 100644
index 0000000..40b2719
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/db.sqlite3 differ
diff --git a/erica_snider/Assignments/Python/Django/main/main/__init__.py b/erica_snider/Assignments/Python/Django/main/main/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/main/main/__init__.pyc b/erica_snider/Assignments/Python/Django/main/main/__init__.pyc
new file mode 100644
index 0000000..d9e731e
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/main/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/main/settings.py b/erica_snider/Assignments/Python/Django/main/main/settings.py
new file mode 100644
index 0000000..c3cef85
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/main/settings.py
@@ -0,0 +1,126 @@
+"""
+Django settings for main project.
+
+Generated by 'django-admin startproject' using Django 1.10.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.10/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.10/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'b43%=5ef9g$cmbp+1jg%tjxyfl=_n-s(550jzjno-)6%00%wgy'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'apps.django_email',
+ # 'apps.ninja_gold',
+ # 'apps.disappearing_ninjas',
+ # 'apps.survey_form',
+ # 'apps.vinmyMVC',
+ # 'apps.first_app',
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+]
+
+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 = 'main.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 = 'main.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.10/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/1.10/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.10/howto/static-files/
+
+STATIC_URL = '/static/'
diff --git a/erica_snider/Assignments/Python/Django/main/main/settings.pyc b/erica_snider/Assignments/Python/Django/main/main/settings.pyc
new file mode 100644
index 0000000..687628b
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/main/settings.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/main/urls.py b/erica_snider/Assignments/Python/Django/main/main/urls.py
new file mode 100644
index 0000000..5854239
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/main/urls.py
@@ -0,0 +1,34 @@
+"""main URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/1.10/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.conf.urls import url, include
+ 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
+"""
+# from django.conf.urls import url
+# from django.contrib import admin
+#
+# urlpatterns = [
+# url(r'^admin/', admin.site.urls),
+# ]
+
+from django.conf.urls import url, include # Notice we added include
+# from django.contrib import admin
+urlpatterns = [
+ url(r'^', include('apps.django_email.urls')) # And now we use include to pull in our first_app.urls...
+]
+
+
+# ^ means start of string
+# $ is the end (forced)
+
+# '^' looks for anything (start followed by anything)
+# '^$' looks for exactly nothing (start followed immediately by end)
diff --git a/erica_snider/Assignments/Python/Django/main/main/urls.pyc b/erica_snider/Assignments/Python/Django/main/main/urls.pyc
new file mode 100644
index 0000000..d5b3994
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/main/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/main/wsgi.py b/erica_snider/Assignments/Python/Django/main/main/wsgi.py
new file mode 100644
index 0000000..4d1e3f4
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/main/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for main 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/1.10/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main.settings")
+
+application = get_wsgi_application()
diff --git a/erica_snider/Assignments/Python/Django/main/main/wsgi.pyc b/erica_snider/Assignments/Python/Django/main/main/wsgi.pyc
new file mode 100644
index 0000000..2e5d5cc
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/main/main/wsgi.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/main/manage.py b/erica_snider/Assignments/Python/Django/main/manage.py
new file mode 100755
index 0000000..ad5d3e7
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/main/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main.settings")
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError:
+ # The above import may fail for some other reason. Ensure that the
+ # issue is really that Django is missing to avoid masking other
+ # exceptions on Python 2.
+ try:
+ import django
+ except ImportError:
+ 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?"
+ )
+ raise
+ execute_from_command_line(sys.argv)
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/__init__.py b/erica_snider/Assignments/Python/Django/random_word_generator/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/__init__.py b/erica_snider/Assignments/Python/Django/random_word_generator/apps/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/__init__.pyc b/erica_snider/Assignments/Python/Django/random_word_generator/apps/__init__.pyc
new file mode 100644
index 0000000..ad76dd7
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/apps/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/__init__.py b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/__init__.pyc b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/__init__.pyc
new file mode 100644
index 0000000..5d15048
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/admin.py b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/admin.pyc b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/admin.pyc
new file mode 100644
index 0000000..efa3f4f
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/apps.py b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/apps.py
new file mode 100644
index 0000000..8cf458f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class FirstAppConfig(AppConfig):
+ name = 'first_app'
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/migrations/__init__.py b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/migrations/__init__.pyc
new file mode 100644
index 0000000..ed38c29
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/models.py b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/models.py
new file mode 100644
index 0000000..bd4b2ab
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/models.py
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+# Create your models here.
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/models.pyc b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/models.pyc
new file mode 100644
index 0000000..4cf286b
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/templates/word_generator/index.html b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/templates/word_generator/index.html
new file mode 100644
index 0000000..0628dae
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/templates/word_generator/index.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+ Random Word (attempt #{{request.session.count}})
+ {{generated_number}}
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/tests.py b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/urls.py b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/urls.py
new file mode 100644
index 0000000..6b72e77
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/urls.py
@@ -0,0 +1,24 @@
+from django.conf.urls import url
+from . import views
+
+
+# Models -- views -- TEMPLATES
+
+
+# def method_to_run(request):
+# print "Whatever route that was hit by an HTTP request (by the way) decided to invoke me!"
+# print "By the way, here's the request object that Django automatically passes us:", request
+# print "By the by, we still aren't delivering anything to the browser, so you should see 'ValueError at /'"
+#
+# urlpatterns = [
+# url(r'^$', method_to_run)
+# ]
+
+# same same in Flask:
+# @app.route('/')
+# def method_to_run():
+
+
+urlpatterns = [
+ url(r'^', views.index) # specifically: r'^$' and r'^generate/$' should run route for index; no other routes in app
+]
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/urls.pyc b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/urls.pyc
new file mode 100644
index 0000000..7311abd
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/views.py b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/views.py
new file mode 100644
index 0000000..540754b
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/views.py
@@ -0,0 +1,21 @@
+from django.shortcuts import render
+import random
+
+
+# CONTROLLER
+
+
+# Create your views here.
+
+def index(request):
+ if 'count' not in request.session:
+ request.session['count'] = 1
+ else:
+ request.session['count'] += 1
+ print "*"*50
+ generated_number = random.randint(10000000000000, 100000000000000)
+ context = {
+ 'generated_number': generated_number
+ }
+ # del request.session['count']
+ return render(request, 'word_generator/index.html',context)
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/views.pyc b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/views.pyc
new file mode 100644
index 0000000..494e281
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/apps/word_generator/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/db.sqlite3 b/erica_snider/Assignments/Python/Django/random_word_generator/db.sqlite3
new file mode 100644
index 0000000..127b96c
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/db.sqlite3 differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/main/__init__.py b/erica_snider/Assignments/Python/Django/random_word_generator/main/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/main/__init__.pyc b/erica_snider/Assignments/Python/Django/random_word_generator/main/__init__.pyc
new file mode 100644
index 0000000..d9e731e
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/main/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/main/settings.py b/erica_snider/Assignments/Python/Django/random_word_generator/main/settings.py
new file mode 100644
index 0000000..ccb29e1
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/random_word_generator/main/settings.py
@@ -0,0 +1,121 @@
+"""
+Django settings for main project.
+
+Generated by 'django-admin startproject' using Django 1.10.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.10/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.10/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'b43%=5ef9g$cmbp+1jg%tjxyfl=_n-s(550jzjno-)6%00%wgy'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'apps.word_generator',
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+]
+
+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 = 'main.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 = 'main.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.10/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/1.10/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.10/howto/static-files/
+
+STATIC_URL = '/static/'
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/main/settings.pyc b/erica_snider/Assignments/Python/Django/random_word_generator/main/settings.pyc
new file mode 100644
index 0000000..c717ccb
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/main/settings.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/main/urls.py b/erica_snider/Assignments/Python/Django/random_word_generator/main/urls.py
new file mode 100644
index 0000000..94d322d
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/random_word_generator/main/urls.py
@@ -0,0 +1,34 @@
+"""main URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/1.10/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.conf.urls import url, include
+ 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
+"""
+# from django.conf.urls import url
+# from django.contrib import admin
+#
+# urlpatterns = [
+# url(r'^admin/', admin.site.urls),
+# ]
+
+from django.conf.urls import url, include # Notice we added include
+# from django.contrib import admin
+urlpatterns = [
+ url(r'^', include('apps.word_generator.urls')) # And now we use include to pull in our first_app.urls...
+]
+
+
+# ^ means start of string
+# $ is the end (forced)
+
+# '^' looks for anything (start followed by anything)
+# '^$' looks for exactly nothing (start followed immediately by end)
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/main/urls.pyc b/erica_snider/Assignments/Python/Django/random_word_generator/main/urls.pyc
new file mode 100644
index 0000000..5a08686
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/main/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/main/wsgi.py b/erica_snider/Assignments/Python/Django/random_word_generator/main/wsgi.py
new file mode 100644
index 0000000..4d1e3f4
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/random_word_generator/main/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for main 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/1.10/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main.settings")
+
+application = get_wsgi_application()
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/main/wsgi.pyc b/erica_snider/Assignments/Python/Django/random_word_generator/main/wsgi.pyc
new file mode 100644
index 0000000..2e5d5cc
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/random_word_generator/main/wsgi.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/random_word_generator/manage.py b/erica_snider/Assignments/Python/Django/random_word_generator/manage.py
new file mode 100755
index 0000000..ad5d3e7
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/random_word_generator/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main.settings")
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError:
+ # The above import may fail for some other reason. Ensure that the
+ # issue is really that Django is missing to avoid masking other
+ # exceptions on Python 2.
+ try:
+ import django
+ except ImportError:
+ 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?"
+ )
+ raise
+ execute_from_command_line(sys.argv)
diff --git a/erica_snider/Assignments/Python/Django/sports_orm b/erica_snider/Assignments/Python/Django/sports_orm
new file mode 160000
index 0000000..0fc2460
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/sports_orm
@@ -0,0 +1 @@
+Subproject commit 0fc2460d5c9c0cef89a340db7cbee46a9dd72eb5
diff --git a/erica_snider/Assignments/Python/Django/sports_orm_ii b/erica_snider/Assignments/Python/Django/sports_orm_ii
new file mode 160000
index 0000000..0fc2460
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/sports_orm_ii
@@ -0,0 +1 @@
+Subproject commit 0fc2460d5c9c0cef89a340db7cbee46a9dd72eb5
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment.zip b/erica_snider/Assignments/Python/Django/time_display_assignment.zip
new file mode 100644
index 0000000..29d47c2
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment.zip differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/__init__.py b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/__init__.pyc b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/__init__.pyc
new file mode 100644
index 0000000..c4f6dcc
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/__init__.py b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/__init__.pyc b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/__init__.pyc
new file mode 100644
index 0000000..5f9e525
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/admin.py b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/admin.pyc b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/admin.pyc
new file mode 100644
index 0000000..ced25a3
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/admin.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/apps.py b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/apps.py
new file mode 100644
index 0000000..f50055b
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class TimedisplayConfig(AppConfig):
+ name = 'timedisplay'
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/migrations/__init__.py b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/migrations/__init__.pyc b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/migrations/__init__.pyc
new file mode 100644
index 0000000..e7e8961
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/migrations/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/models.py b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/models.py
new file mode 100644
index 0000000..bd4b2ab
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/models.py
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+# Create your models here.
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/models.pyc b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/models.pyc
new file mode 100644
index 0000000..d799c49
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/models.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/templates/timedisplay/index.html b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/templates/timedisplay/index.html
new file mode 100644
index 0000000..a4d0f2a
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/templates/timedisplay/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+ Time Display
+
+
+ The current time and date:
+ {{ datetime.month }} {{ datetime.day }}, {{ datetime.year}}
+ {{ datetime.hour }} {{ datetime.minute }}
+
+
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/tests.py b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/urls.py b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/urls.py
new file mode 100644
index 0000000..08be48e
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/urls.py
@@ -0,0 +1,6 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index)
+]
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/urls.pyc b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/urls.pyc
new file mode 100644
index 0000000..baf4ff0
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/views.py b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/views.py
new file mode 100644
index 0000000..144226f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/views.py
@@ -0,0 +1,16 @@
+from django.shortcuts import render
+import datetime, time
+
+# Create your views here.
+def index(request):
+ now = datetime.datetime.now()
+ context = {
+ 'datetime': { 'year': now.year,
+ 'month': now.month,
+ 'day': now.day,
+ 'hour': now.hour,
+ 'minute': now.minute,
+ 'second': now.second
+ }
+ }
+ return render(request, 'timedisplay/index.html', context)
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/views.pyc b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/views.pyc
new file mode 100644
index 0000000..855ffa9
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/apps/timedisplay/views.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/db.sqlite3 b/erica_snider/Assignments/Python/Django/time_display_assignment/db.sqlite3
new file mode 100644
index 0000000..00c4dcb
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/db.sqlite3 differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/manage.py b/erica_snider/Assignments/Python/Django/time_display_assignment/manage.py
new file mode 100755
index 0000000..5816cc8
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/time_display_assignment/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "time_display_assignment.settings")
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError:
+ # The above import may fail for some other reason. Ensure that the
+ # issue is really that Django is missing to avoid masking other
+ # exceptions on Python 2.
+ try:
+ import django
+ except ImportError:
+ 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?"
+ )
+ raise
+ execute_from_command_line(sys.argv)
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/__init__.py b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/__init__.pyc b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/__init__.pyc
new file mode 100644
index 0000000..4a09656
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/settings.py b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/settings.py
new file mode 100644
index 0000000..47bcec9
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/settings.py
@@ -0,0 +1,121 @@
+"""
+Django settings for time_display_assignment project.
+
+Generated by 'django-admin startproject' using Django 1.10.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.10/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.10/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = '&0u**ytuq!$eknn!l^low%yyyq%z+bji#byvgdor3t*=x@ugal'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'apps.timedisplay',
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+]
+
+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 = 'time_display_assignment.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 = 'time_display_assignment.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.10/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/1.10/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.10/howto/static-files/
+
+STATIC_URL = '/static/'
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/settings.pyc b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/settings.pyc
new file mode 100644
index 0000000..c6edbb1
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/settings.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/urls.py b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/urls.py
new file mode 100644
index 0000000..ee8ffc9
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/urls.py
@@ -0,0 +1,20 @@
+"""time_display_assignment URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/1.10/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.conf.urls import url, include
+ 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
+"""
+from django.conf.urls import url, include
+
+urlpatterns = [
+ url(r'^', include('apps.timedisplay.urls'))
+]
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/urls.pyc b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/urls.pyc
new file mode 100644
index 0000000..cb50a7d
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/urls.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/wsgi.py b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/wsgi.py
new file mode 100644
index 0000000..47b46aa
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for time_display_assignment 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/1.10/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "time_display_assignment.settings")
+
+application = get_wsgi_application()
diff --git a/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/wsgi.pyc b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/wsgi.pyc
new file mode 100644
index 0000000..411a1e2
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/time_display_assignment/time_display_assignment/wsgi.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/apps/__init__.py b/erica_snider/Assignments/Python/Django/wall_erd/apps/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/__init__.py b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/admin.py b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/apps.py b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/apps.py
new file mode 100644
index 0000000..97e1552
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/apps.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class WallEntityRelationshipConfig(AppConfig):
+ name = 'wall_entity_relationship'
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/migrations/__init__.py b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/models.py b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/models.py
new file mode 100644
index 0000000..4d802d0
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/models.py
@@ -0,0 +1,46 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+class User(models.Model):
+ first_name = models.CharField(max_length=255)
+ last_name = models.CharField(max_length=255)
+ email = models.CharField(max_length=255)
+ password = models.CharField(max_length=255)
+ created_at = models.DateTimeField(auto_now_add = True)
+ updated_at = models.DateTimeField(auto_now = True)
+
+class Message(models.Model):
+ creator = models.ForeignKey(User, related_name='users_message')
+ message = models.TextField(max_length=1000)
+ created_at = models.DateTimeField(auto_now_add = True)
+ updated_at = models.DateTimeField(auto_now = True)
+
+class Comment(models.Model):
+ creator = models.ForeignKey(User, related_name='users_comment')
+ on_message = models.ForeignKey(Message, related_name='messages_comment')
+ comment = models.TextField(max_length=1000)
+ created_at = models.DateTimeField(auto_now_add = True)
+ updated_at = models.DateTimeField(auto_now = True)
+
+#############
+# SOLUTION: #
+#############
+# class User(models.Model):
+# first_name = models.CharField(max_length=200)
+# last_name = models.CharField(max_length=200)
+# email = models.EmailField()
+# password = models.CharField(max_length=200)
+# created_at = models.DateTimeField(auto_now_add=True)
+# updated_at = models.DateTimeField(auto_now=True)
+# class Message(models.Model):
+# message = models.TextField()
+# user = models.ForeignKey(User)
+# created_at = models.DateTimeField(auto_now_add=True)
+# updated_at = models.DateTimeField(auto_now=True)
+# class Comment(models.Model):
+# comment = models.TextField()
+# user = models.ForeignKey(User)
+# message = models.ForeignKey(Message)
+# created_at = models.DateTimeField(auto_now_add=True)
+# updated_at = models.DateTimeField(auto_now=True)
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/templates/wall_entity_relationship/index.html b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/templates/wall_entity_relationship/index.html
new file mode 100644
index 0000000..d56194f
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/templates/wall_entity_relationship/index.html
@@ -0,0 +1,45 @@
+
+
+ Welcome
+
+
+
+
+
+ {% with messages = get_flashed_messages() %}
+ {% if messages %}
+ {% for message in messages %}
+ {{message}}
+ {% endfor %}
+ {% endif %}
+ {% endwith %}
+
+
+ {{ session['id'] }}
+
+
+ Register new user
+
+
+
+ Login
+
+
+
+ {{ all_users }}
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/templates/wall_entity_relationship/wall.html b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/templates/wall_entity_relationship/wall.html
new file mode 100644
index 0000000..432be2d
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/templates/wall_entity_relationship/wall.html
@@ -0,0 +1,57 @@
+
+
+ Wall
+
+
+
+
+ flash messages:
+ {% with messages = get_flashed_messages() %}
+ {% if messages %}
+ {% for message in messages %}
+ {{message}}
+ {% endfor %}
+ {% endif %}
+ {% endwith %}
+
+
+ session user id: {{ session['id'] }}
+
+
+ Post a message
+
+
+
+
+ {% for message in all_messages %}
+ Message by {{ message['first_name'] }} on {{ message['last_name'] }} at {{ message['created_at'] }}
+ {{ message['message'] }}
+
+ {% for comment in all_comments %}
+ {% if comment['messages_id'] == message['id'] %}
+ Comment by {{ comment['first_name'] }} on {{ comment['last_name'] }} at {{ comment['created_at'] }}
+ {{ comment['comment'] }}
+ {% endif %}
+ {% endfor %}
+
+ Post a comment
+
+
+ {% endfor %}
+
+
+
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/tests.py b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/urls.py b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/urls.py
new file mode 100644
index 0000000..525e0c7
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/urls.py
@@ -0,0 +1,12 @@
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index),
+ url(r'^register$', views.create),
+ url(r'^login$', views.login),
+ url(r'^logout$', views.logout),
+ url(r'^message$', views.message),
+ url(r'^comment$', views.comment),
+ url(r'^wall$', views.wall)
+]
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/views.py b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/views.py
new file mode 100644
index 0000000..91ea44a
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/apps/wall_entity_relationship/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/manage.py b/erica_snider/Assignments/Python/Django/wall_erd/manage.py
new file mode 100755
index 0000000..865adb3
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wall_erd.settings")
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError:
+ # The above import may fail for some other reason. Ensure that the
+ # issue is really that Django is missing to avoid masking other
+ # exceptions on Python 2.
+ try:
+ import django
+ except ImportError:
+ 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?"
+ )
+ raise
+ execute_from_command_line(sys.argv)
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/__init__.py b/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/__init__.pyc b/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/__init__.pyc
new file mode 100644
index 0000000..b25b8e4
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/__init__.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/settings.py b/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/settings.py
new file mode 100644
index 0000000..71b56f4
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/settings.py
@@ -0,0 +1,121 @@
+"""
+Django settings for wall_erd project.
+
+Generated by 'django-admin startproject' using Django 1.10.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.10/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.10/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = '-yq9i=#glkdf4ccn=k=a-pu@35et)%3(e2d3vzir$(88+82!t4'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'apps.wall_entity_relationship',
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+]
+
+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 = 'wall_erd.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 = 'wall_erd.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.10/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/1.10/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.10/howto/static-files/
+
+STATIC_URL = '/static/'
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/settings.pyc b/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/settings.pyc
new file mode 100644
index 0000000..1e5c697
Binary files /dev/null and b/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/settings.pyc differ
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/urls.py b/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/urls.py
new file mode 100644
index 0000000..9be85ab
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/urls.py
@@ -0,0 +1,22 @@
+"""wall_erd URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/1.10/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.conf.urls import url, include
+ 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
+"""
+from django.conf.urls import url, include
+# from django.contrib import admin
+
+urlpatterns = [
+ # url(r'^admin/', admin.site.urls),
+ url(r'^', include('apps.wall_entity_relationship.urls'))
+]
diff --git a/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/wsgi.py b/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/wsgi.py
new file mode 100644
index 0000000..aad8145
--- /dev/null
+++ b/erica_snider/Assignments/Python/Django/wall_erd/wall_erd/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for wall_erd 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/1.10/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wall_erd.settings")
+
+application = get_wsgi_application()