diff --git a/Assignment/Homework_1 - HTML/myFirstPage_V1.html b/Assignment/Homework_1 - HTML/myFirstPage_V1.html new file mode 100755 index 0000000..0dd2455 --- /dev/null +++ b/Assignment/Homework_1 - HTML/myFirstPage_V1.html @@ -0,0 +1,108 @@ + + + + My First Page + + + +
+

+

Pokedex

+

+
+ + +
+ +
+ +
+ +
+

No. 001 Pickahu

+ +
+
+ +
+
+

Pickahu can be seen napping in a bright sunlight. It has two + red dots + on its cheeks. By practicing html and css Pickahu can learn confusion. + Pickahu likes to steal computer chargers from sleeping college students. +

+
+
+ + +
+ + + +
+ + + + + + + diff --git a/Assignment/Homework_2 - CSS_ResponsiveDesign/main.css b/Assignment/Homework_2 - CSS_ResponsiveDesign/main.css new file mode 100644 index 0000000..1caae53 --- /dev/null +++ b/Assignment/Homework_2 - CSS_ResponsiveDesign/main.css @@ -0,0 +1,131 @@ +/*----------------- CSS RESET ------------------*/ +body{ + width: 900px; + height: 1200px; + margin: 0 auto; + background-image: url("assets/backgrounds/background_home.png"); + background-repeat: no-repeat; + background-size:900px; + background-position: center +} + +div.container { + width: 100%; + border: 1px solid gray; +} + +/* +a.button { + -webkit-appearance: button; + -moz-appearance: button; + appearance: button; + text-decoration: none; + color: initial; + display: inline-block; + height: 50%; + border: 3px solid black; + box-sizing: content-box; +} + */ +button { + display: inline-block; + height: 30px; + width: 100px; +/* border: 2px solid black; */ +/* box-sizing: content-box; */ + border-radius: 10px; +} + +header { + color: white; + background-color: #BE5959; + font-family: calibri; + display: flex; + justify-content: space-around; +} + +h2 { + color: white; + background-color: #5C90CC; + margin-top: 0; + text-align: center; +} + +.search_text{ + margin-top: 20px; + margin-left: 20px; + margin-right: 20px; + margin-bottom: 20px; + font-family: calibri; +} + +#inputSearchText{ + width: 100%; + height: 100%; + font-size: 40px; + padding-left: 20px; +} + +ul{ + list-style-type:none; +} + +nav { + background-color: #5C90CC; + width: 100%; + height: 5%; + float: center; +} + +.pok_insights { + margin: auto; + width: 94%; + border: 2px solid #646262; + padding: 0; + text-align: left; + font-family: calibri; + background-color: white; + +} + + +.pok_descript { +/* height: 100px; */ + margin: auto; + width: 90%; + border: 8px solid #BE5959; + border-radius: 20px 20px 20px 20px; + text-align: center; + font-family: calibri; + background-color: white; + +} + +#lblPokedex{ + alignment-adjust:central; +} + +.grid{ + border: 2px solid black; +} + + +ul#main_menu li{ +display: inline-block; +background-color: red; +border: 5px solid; +list-style: none; +padding: 3px; +border-radius: 5px 5px; +} + + +/** flex stuff **/ +.grid-parent{ + display: flex; + flex-wrap: wrap; +} + +.grid{ + width: 16% +} diff --git a/Assignment/Homework_2 - CSS_ResponsiveDesign/medium.css b/Assignment/Homework_2 - CSS_ResponsiveDesign/medium.css new file mode 100644 index 0000000..e0fe361 --- /dev/null +++ b/Assignment/Homework_2 - CSS_ResponsiveDesign/medium.css @@ -0,0 +1 @@ +/*Your tablet targeted CSS should go in this file*/ diff --git a/Assignment/Homework_2 - CSS_ResponsiveDesign/myFirstPage-Good.html b/Assignment/Homework_2 - CSS_ResponsiveDesign/myFirstPage-Good.html new file mode 100755 index 0000000..4ac2e12 --- /dev/null +++ b/Assignment/Homework_2 - CSS_ResponsiveDesign/myFirstPage-Good.html @@ -0,0 +1,208 @@ + + + + My First Page + + + + + + + +
+ + + + + + +

Pokedex

Empty
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Empty + +
+

No. 001 Pickahu

+
    +
  • - Electric type
  • +
  • - Gentle Temperment
  • +
  • - Grasslands
  • +
+
+
+
+
+

Pickahu can be seen napping in a bright sunlight. It has two + red dots on its cheeks. By practicing html and css Pickahu can learn confusion. + Pickahu likes to steal computer chargers from sleeping college students. +

+
+
+
EmptyEmptyEmptyEmptyEmptyEmpty
EmptyEmptyEmptyEmptyEmptyEmpty
+ + + + + + + + + + + diff --git a/Assignment/Homework_2 - CSS_ResponsiveDesign/myFirstPage.html b/Assignment/Homework_2 - CSS_ResponsiveDesign/myFirstPage.html new file mode 100755 index 0000000..41cccee --- /dev/null +++ b/Assignment/Homework_2 - CSS_ResponsiveDesign/myFirstPage.html @@ -0,0 +1,86 @@ + + + + + + Pokedex displays + + + + + + + +
+ + + + + + +

Pokedex

Empty
+
+ + +
+ +
+ + + + + + +
+ Empty + +
+

No. 001 Pickahu

+
    +
  • - Electric type
  • +
  • - Gentle Temperment
  • +
  • - Grasslands
  • +
+
+
+ +
+
+

Pickahu can be seen napping in a bright sunlight. It has two + red dots on its cheeks. By practicing html and css Pickahu can learn confusion.

+

Pickahu likes to steal computer chargers from sleeping college students. +

+
+
+ + + +
+
Empty
+
Empty
+
Empty
+
Empty
+
Empty
+
Empty
+
Empty
+
Empty
+
Empty
+
Empty
+
Empty
+
Empty
+ +
+ + + + + diff --git a/Assignment/Homework_2 - CSS_ResponsiveDesign/small.css b/Assignment/Homework_2 - CSS_ResponsiveDesign/small.css new file mode 100644 index 0000000..06fa3d9 --- /dev/null +++ b/Assignment/Homework_2 - CSS_ResponsiveDesign/small.css @@ -0,0 +1 @@ +/*Your mobile targeted css should go here*/ diff --git a/Assignment/Homework_2 - CSS_ResponsiveDesign/~$structions HW2 Responsive_Design.docx b/Assignment/Homework_2 - CSS_ResponsiveDesign/~$structions HW2 Responsive_Design.docx deleted file mode 100644 index 37240c4..0000000 Binary files a/Assignment/Homework_2 - CSS_ResponsiveDesign/~$structions HW2 Responsive_Design.docx and /dev/null differ diff --git a/Labs/Lab - orm_tutorial/app.db b/Labs/Lab - orm_tutorial/app.db new file mode 100755 index 0000000..913aa35 Binary files /dev/null and b/Labs/Lab - orm_tutorial/app.db differ diff --git a/Labs/Lab - orm_tutorial/app/__init__.py b/Labs/Lab - orm_tutorial/app/__init__.py new file mode 100755 index 0000000..353d3af --- /dev/null +++ b/Labs/Lab - orm_tutorial/app/__init__.py @@ -0,0 +1,8 @@ +from flask import Flask +from flask.ext.sqlalchemy import SQLAlchemy + +app = Flask(__name__) +app.config.from_object('config') +db = SQLAlchemy(app) + +from app import views, models diff --git a/Labs/Lab - orm_tutorial/app/__init__.pyc b/Labs/Lab - orm_tutorial/app/__init__.pyc new file mode 100644 index 0000000..7773f19 Binary files /dev/null and b/Labs/Lab - orm_tutorial/app/__init__.pyc differ diff --git a/Labs/Lab - orm_tutorial/app/forms.py b/Labs/Lab - orm_tutorial/app/forms.py new file mode 100755 index 0000000..5724699 --- /dev/null +++ b/Labs/Lab - orm_tutorial/app/forms.py @@ -0,0 +1,9 @@ +from flask.ext.wtf import Form +from wtforms import StringField, IntegerField +from flask_wtf.html5 import EmailField +from wtforms.validators import DataRequired + +class CustomerForm(Form): + company = StringField('company', validators=[DataRequired()]) + email = EmailField('email', validators=[DataRequired()]) + # Add additional Address fields here diff --git a/Labs/Lab - orm_tutorial/app/forms.pyc b/Labs/Lab - orm_tutorial/app/forms.pyc new file mode 100644 index 0000000..669b7b7 Binary files /dev/null and b/Labs/Lab - orm_tutorial/app/forms.pyc differ diff --git a/Labs/Lab - orm_tutorial/app/models.py b/Labs/Lab - orm_tutorial/app/models.py new file mode 100755 index 0000000..ae19b55 --- /dev/null +++ b/Labs/Lab - orm_tutorial/app/models.py @@ -0,0 +1,3 @@ +from app import db + +# Your Customer Database code should go here diff --git a/Labs/Lab - orm_tutorial/app/models.pyc b/Labs/Lab - orm_tutorial/app/models.pyc new file mode 100644 index 0000000..0aae0da Binary files /dev/null and b/Labs/Lab - orm_tutorial/app/models.pyc differ diff --git a/Labs/Lab - orm_tutorial/app/templates/base.html b/Labs/Lab - orm_tutorial/app/templates/base.html new file mode 100755 index 0000000..db51f24 --- /dev/null +++ b/Labs/Lab - orm_tutorial/app/templates/base.html @@ -0,0 +1,14 @@ + + + {% if title %} + {{ title }} - ACME + {% else %} + Welcome to ACME Aircraft Parts + {% endif %} + + + + + {% block content %}{% endblock %} + + diff --git a/Labs/Lab - orm_tutorial/app/templates/customer.html b/Labs/Lab - orm_tutorial/app/templates/customer.html new file mode 100755 index 0000000..d7b457a --- /dev/null +++ b/Labs/Lab - orm_tutorial/app/templates/customer.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} +{% block content %} +
+
+
+ Home +
+

Add Customer to Our Database

+
+ {{ form.hidden_tag() }} +
+
+

+ Company name:
+ {{ form.company(size=120) }}
+

+

+ Customer email:
+ {{ form.email(size=120) }}
+

+
+
+
+ +
+

+
+
+
+{% endblock %} diff --git a/Labs/Lab - orm_tutorial/app/templates/home.html b/Labs/Lab - orm_tutorial/app/templates/home.html new file mode 100755 index 0000000..6b447ec --- /dev/null +++ b/Labs/Lab - orm_tutorial/app/templates/home.html @@ -0,0 +1,31 @@ +{% extends "base.html" %} +{% block content %} +
+
+

Welcome to ACME Aircraft Parts

+ +
+
+

These are all of our awesome customers:

+ + + + + + + + {% for customer in customers %} + + + + + + {% endfor %} +
CompanyEmail
{{ customer.company }}{{ customer.email }}
+
+
+
+{% endblock %} diff --git a/Labs/Lab - orm_tutorial/app/views.py b/Labs/Lab - orm_tutorial/app/views.py new file mode 100755 index 0000000..dab8eed --- /dev/null +++ b/Labs/Lab - orm_tutorial/app/views.py @@ -0,0 +1,21 @@ +from flask import render_template, redirect, request +from app import app, models, db +from .forms import CustomerForm + + +@app.route('/') +def index(): + return redirect('/create_customer') + +@app.route('/create_customer', methods=['GET', 'POST']) +def create_customer(): + form = CustomerForm() + #Capture form data and send to database + return redirect('/customers') + return render_template('customer.html', form=form) + +@app.route('/customers') +def display_customer(): + #Fetch customer data from database + return render_template('home.html', + customers=customers) diff --git a/Labs/Lab - orm_tutorial/app/views.pyc b/Labs/Lab - orm_tutorial/app/views.pyc new file mode 100644 index 0000000..e27a6bd Binary files /dev/null and b/Labs/Lab - orm_tutorial/app/views.pyc differ diff --git a/Labs/Lab - orm_tutorial/config.py b/Labs/Lab - orm_tutorial/config.py new file mode 100755 index 0000000..a995426 --- /dev/null +++ b/Labs/Lab - orm_tutorial/config.py @@ -0,0 +1,8 @@ +import os +basedir = os.path.abspath(os.path.dirname(__file__)) + +SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') +SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository') + +WTF_CSRF_ENABLED = True +SECRET_KEY = 'you-will-never-guess' diff --git a/Labs/Lab - orm_tutorial/config.pyc b/Labs/Lab - orm_tutorial/config.pyc new file mode 100644 index 0000000..59af7fd Binary files /dev/null and b/Labs/Lab - orm_tutorial/config.pyc differ diff --git a/Labs/Lab - orm_tutorial/readme.md b/Labs/Lab - orm_tutorial/readme.md new file mode 100755 index 0000000..f5a8d70 --- /dev/null +++ b/Labs/Lab - orm_tutorial/readme.md @@ -0,0 +1,21 @@ +# Models Lab/Homework +The goal for this lab is to get you comfortable translating your database models into actual code. We will be using [ORMs](https://en.wikipedia.org/wiki/Object-relational_mapping) to help us. The particular ORM that we will be using is SQLAlchemy (the flask implementation is called [Flask-SQLAlchemy](http://flask-sqlalchemy.pocoo.org/2.1/)). + +We'll walk through the example together in class which will give you an idea of how this all works together. Your goal for this lab and homework is to create the remaining models, forms, and routes to complete v2 of the exercise from last week. + +This means that you must: +* Create the following tables and the appropriate relationships: + * customer + * address + * order + * Remember to run update_database.py whenever you make changes to any models. + * This will update the database with your changes. However, **it will delete any data in the database**. +* Create the forms, templates, routes, etc necessary to input this data into the database. +* Create a view to showcase the data into your database (see the current implementation of "home.html" for example) + +The following documentation will help answer any questions you may have. + +## Helpful Documentation +- [Flask-SQLAlchemy](http://flask-sqlalchemy.pocoo.org/2.1/) +- [Accessing SQLite3 Command Shell](https://www.sqlite.org/cli.html) +- [Flask-WTF](https://flask-wtf.readthedocs.org/en/latest/) (flask plugin for creating forms easily) diff --git a/Labs/Lab - orm_tutorial/requirements.txt b/Labs/Lab - orm_tutorial/requirements.txt new file mode 100755 index 0000000..bfbaf81 --- /dev/null +++ b/Labs/Lab - orm_tutorial/requirements.txt @@ -0,0 +1,10 @@ +Flask==0.10.1 +Flask-SQLAlchemy==2.1 +Flask-WTF==0.12 +itsdangerous==0.24 +Jinja2==2.8 +MarkupSafe==0.23 +SQLAlchemy==1.0.12 +Werkzeug==0.11.4 +wheel==0.29.0 +WTForms==2.1 diff --git a/Labs/Lab - orm_tutorial/run.py b/Labs/Lab - orm_tutorial/run.py new file mode 100755 index 0000000..5d2f714 --- /dev/null +++ b/Labs/Lab - orm_tutorial/run.py @@ -0,0 +1,2 @@ +from app import app +app.run(debug=True, host="0.0.0.0", port=8081) diff --git a/Labs/Lab - orm_tutorial/update_database.py b/Labs/Lab - orm_tutorial/update_database.py new file mode 100755 index 0000000..b15e4da --- /dev/null +++ b/Labs/Lab - orm_tutorial/update_database.py @@ -0,0 +1,3 @@ +from app import db +db.drop_all() +db.create_all()