-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #334 from PdxCodeGuild/michael-django-lab01
Michael django lab01 completed
- Loading branch information
Showing
48 changed files
with
1,457 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from smtplib import SMTP | ||
from email.message import EmailMessage | ||
|
||
|
||
def email_alert(to, subject="Alert", body="Alert!"): | ||
msg = EmailMessage() | ||
msg.set_content(body) | ||
msg["Subject"] = subject | ||
msg["To"] = to | ||
|
||
user = "[email protected]" | ||
msg["From"] = user | ||
password = "nixqgstknzqcfqig" | ||
port = int(587) | ||
|
||
with SMTP("smtp.gmail.com", port) as server: | ||
server.starttls() | ||
server.login(user, password) | ||
|
||
server.send_message(msg) | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
print("test") | ||
email_alert("[email protected]", "hey", "hello world") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# poetry | ||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control | ||
#poetry.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
#.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Personal Assistant | ||
|
||
## Install | ||
|
||
- pip3 install -r requirements.txt | ||
- python3 manage.py migrate | ||
- Optional: python3 manage.py createsuperuser | ||
- python3 manage.py runserver |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
from .models import * | ||
|
||
admin.site.register(Priority) | ||
admin.site.register(TodoItem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AssistantConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "assistant" |
62 changes: 62 additions & 0 deletions
62
Code/Michael/django/lab01/lab01project/assistant/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Generated by Django 3.2.10 on 2022-03-06 17:32 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Priority", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"name", | ||
models.CharField( | ||
choices=[ | ||
("High", "High"), | ||
("Medium", "Medium"), | ||
("Low", "Low"), | ||
], | ||
default="Medium", | ||
max_length=6, | ||
), | ||
), | ||
], | ||
options={ | ||
"ordering": ["-name"], | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="TodoItem", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("name", models.CharField(max_length=250)), | ||
("description", models.TextField()), | ||
("completed", models.DateTimeField(blank=True, null=True)), | ||
], | ||
options={ | ||
"ordering": ["-priority"], | ||
}, | ||
), | ||
] |
32 changes: 32 additions & 0 deletions
32
Code/Michael/django/lab01/lab01project/assistant/migrations/0002_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Generated by Django 3.2.10 on 2022-03-06 17:32 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
("assistant", "0001_initial"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="todoitem", | ||
name="owner", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="todoitem", | ||
name="priority", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="assistant.priority" | ||
), | ||
), | ||
] |
22 changes: 22 additions & 0 deletions
22
Code/Michael/django/lab01/lab01project/assistant/migrations/0003_alter_priority_name.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 3.2.10 on 2022-03-06 17:47 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("assistant", "0002_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="priority", | ||
name="name", | ||
field=models.CharField( | ||
choices=[(1, "High"), (2, "Medium"), (3, "Low")], | ||
default=2, | ||
max_length=6, | ||
), | ||
), | ||
] |
22 changes: 22 additions & 0 deletions
22
Code/Michael/django/lab01/lab01project/assistant/migrations/0004_alter_priority_name.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 3.2.10 on 2022-03-06 17:48 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("assistant", "0003_alter_priority_name"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="priority", | ||
name="name", | ||
field=models.CharField( | ||
choices=[("High", 1), ("Medium", 2), ("Low", 3)], | ||
default="Medium", | ||
max_length=6, | ||
), | ||
), | ||
] |
22 changes: 22 additions & 0 deletions
22
Code/Michael/django/lab01/lab01project/assistant/migrations/0005_alter_priority_name.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 3.2.10 on 2022-03-06 17:50 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("assistant", "0004_alter_priority_name"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="priority", | ||
name="name", | ||
field=models.CharField( | ||
choices=[(1, "High"), ("Medium", 2), ("Low", 3)], | ||
default="Medium", | ||
max_length=6, | ||
), | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
Code/Michael/django/lab01/lab01project/assistant/migrations/0006_alter_priority_name.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 3.2.10 on 2022-03-06 17:51 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("assistant", "0005_alter_priority_name"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="priority", | ||
name="name", | ||
field=models.CharField( | ||
choices=[(1, 1), (2, 2), (3, 3)], default="Medium", max_length=6 | ||
), | ||
), | ||
] |
Oops, something went wrong.