Skip to content

Commit 663b066

Browse files
committed
First commmmmit!
0 parents  commit 663b066

38 files changed

+692
-0
lines changed

db.sqlite3

140 KB
Binary file not shown.

manage.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todowoo.settings')
9+
try:
10+
from django.core.management import execute_from_command_line
11+
except ImportError as exc:
12+
raise ImportError(
13+
"Couldn't import Django. Are you sure it's installed and "
14+
"available on your PYTHONPATH environment variable? Did you "
15+
"forget to activate a virtual environment?"
16+
) from exc
17+
execute_from_command_line(sys.argv)
18+
19+
20+
if __name__ == '__main__':
21+
main()

todo/__init__.py

Whitespace-only changes.
148 Bytes
Binary file not shown.

todo/__pycache__/admin.cpython-38.pyc

465 Bytes
Binary file not shown.

todo/__pycache__/forms.cpython-38.pyc

586 Bytes
Binary file not shown.
828 Bytes
Binary file not shown.

todo/__pycache__/views.cpython-38.pyc

3.56 KB
Binary file not shown.

todo/admin.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from django.contrib import admin
2+
from .models import Todo
3+
4+
class TodoAdmin(admin.ModelAdmin):
5+
readonly_fields = ('created',)
6+
7+
admin.site.register(Todo, TodoAdmin)

todo/apps.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class TodoConfig(AppConfig):
5+
name = 'todo'

todo/forms.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from django.forms import ModelForm
2+
from .models import Todo
3+
4+
class TodoForm(ModelForm):
5+
class Meta:
6+
model = Todo
7+
fields = ['title', 'memo', 'important']

todo/migrations/0001_initial.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Generated by Django 3.0 on 2020-01-31 01:28
2+
3+
from django.conf import settings
4+
from django.db import migrations, models
5+
import django.db.models.deletion
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
initial = True
11+
12+
dependencies = [
13+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14+
]
15+
16+
operations = [
17+
migrations.CreateModel(
18+
name='Todo',
19+
fields=[
20+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21+
('title', models.CharField(max_length=100)),
22+
('memo', models.TextField(blank=True)),
23+
('created', models.DateTimeField(auto_now_add=True)),
24+
('datecompleted', models.DateTimeField(null=True)),
25+
('important', models.BooleanField(default=False)),
26+
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
27+
],
28+
),
29+
]
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.0 on 2020-01-31 01:31
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('todo', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='todo',
15+
name='datecompleted',
16+
field=models.DateTimeField(blank=True, null=True),
17+
),
18+
]

todo/migrations/__init__.py

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
159 Bytes
Binary file not shown.

todo/models.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from django.db import models
2+
from django.contrib.auth.models import User
3+
4+
class Todo(models.Model):
5+
title = models.CharField(max_length=100)
6+
memo = models.TextField(blank=True)
7+
created = models.DateTimeField(auto_now_add=True)
8+
datecompleted = models.DateTimeField(null=True, blank=True)
9+
important = models.BooleanField(default=False)
10+
user = models.ForeignKey(User, on_delete=models.CASCADE)
11+
12+
def __str__(self):
13+
return self.title

todo/static/todo/logo.png

40.7 KB
Loading

todo/templates/todo/base.html

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{% load static %}
2+
<!doctype html>
3+
<html lang="en">
4+
<head>
5+
<!-- Required meta tags -->
6+
<meta charset="utf-8">
7+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
8+
9+
<!-- Bootstrap CSS -->
10+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
11+
12+
<link rel="icon" type="image/png" href="{% static 'todo/logo.png' %}">
13+
<title>Todo Woo</title>
14+
</head>
15+
<body>
16+
17+
18+
<nav class="navbar navbar-expand-md navbar-light bg-warning">
19+
<div class="container">
20+
<a class="navbar-brand" href="{% url 'home' %}">
21+
<img src="{% static 'todo/logo.png' %}" width="30" height="30" class="d-inline-block align-top">
22+
<span>Todo Woo</span>
23+
</a>
24+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
25+
<span class="navbar-toggler-icon"></span>
26+
</button>
27+
<div class="collapse navbar-collapse" id="navbarNav">
28+
{% if user.is_authenticated %}
29+
<ul class="navbar-nav mr-auto">
30+
31+
<li class="nav-item {{ current }}">
32+
<a class="nav-link" href="{% url 'currenttodos' %}">Current</a>
33+
</li>
34+
<li class="nav-item {{ completed }}">
35+
<a class="nav-link" href="{% url 'completedtodos' %}">Completed</a>
36+
</li>
37+
<li class="nav-item {{ create }}">
38+
<a class="nav-link" href="{% url 'createtodo' %}">Create</a>
39+
</li>
40+
41+
</ul>
42+
{% endif %}
43+
<ul class="navbar-nav ml-auto">
44+
{% if user.is_authenticated %}
45+
<li class="nav-item">
46+
<a href="#" onclick="$('#signOutBtn').click()" class="nav-link">Logout</a>
47+
<form style='display: none;' method="POST" action="{% url 'logoutuser' %}">
48+
{% csrf_token %}
49+
<button id="signOutBtn" type="submit">Logout</button>
50+
</form>
51+
</li>
52+
{% else %}
53+
<li class="nav-item">
54+
<a class="nav-link" href="{% url 'signupuser' %}">Sign Up</a>
55+
</li>
56+
<li class="nav-item">
57+
<a class="nav-link" href="{% url 'loginuser' %}">Login</a>
58+
</li>
59+
{% endif %}
60+
</ul>
61+
</div>
62+
</div>
63+
</nav>
64+
65+
<div class="container">
66+
{% block content %}{% endblock %}
67+
</div>
68+
69+
<!-- Optional JavaScript -->
70+
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
71+
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
72+
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
73+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
74+
</body>
75+
</html>
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{% extends "todo/base.html" %}
2+
3+
{% block content %}
4+
<div class="row justify-content-center mt-5">
5+
<div class="col-md-10">
6+
<h1>Completed Todos</h1>
7+
</div>
8+
</div>
9+
<div class="row justify-content-center mt-5">
10+
<div class="col-md-10">
11+
<div class="list-group">
12+
{% for todo in todos %}
13+
<a href="{% url 'viewtodo' todo.id %}" class="list-group-item list-group-item-action{% if todo.important %} list-group-item-danger{% endif %}"><b>{{ todo.title }}</b> - Completed {{ todo.datecompleted|date:'M j Y H:i' }}</a>
14+
{% endfor %}
15+
</div>
16+
</div>
17+
</div>
18+
{% endblock %}

todo/templates/todo/createtodo.html

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{% extends "todo/base.html" %}
2+
3+
{% block content %}
4+
<div class="row justify-content-center mt-5">
5+
<div class="col-md-5">
6+
<h2>New Todo</h2>
7+
</div>
8+
</div>
9+
<div class="row justify-content-center mt-5">
10+
<div class="col-md-5">
11+
{% if error %}
12+
<div class="alert alert-danger" role="alert">
13+
{{ error }}
14+
</div>
15+
{% endif %}
16+
<form method="POST">
17+
{% csrf_token %}
18+
<div class="form-group">
19+
<label for="title">Title</label>
20+
<input type="text" name="title" class="form-control" id="title" required>
21+
</div>
22+
<div class="form-group">
23+
<label for="memo">Memo</label>
24+
<textarea name="memo" class="form-control" id="memo" ></textarea>
25+
</div>
26+
<div class="form-group form-check">
27+
<input type="checkbox" name="important" class="form-check-input" id="important">
28+
<label class="form-check-label" for="important">Important</label>
29+
</div>
30+
<button type="submit" class="btn btn-primary">Save</button>
31+
</form>
32+
</div>
33+
</div>
34+
{% endblock %}

todo/templates/todo/currenttodos.html

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{% extends "todo/base.html" %}
2+
3+
{% block content %}
4+
<div class="row justify-content-center mt-5">
5+
<div class="col-md-10">
6+
{% if todos %}
7+
<h1>{{ todos.count }} Current Todo{{ todos.count|pluralize }}</h1>
8+
{% else %}
9+
<h1>Current Todos</h1>
10+
{% endif %}
11+
</div>
12+
</div>
13+
<div class="row justify-content-center mt-5">
14+
<div class="col-md-10">
15+
{% if todos %}
16+
<div class="list-group">
17+
{% for todo in todos %}
18+
<a href="{% url 'viewtodo' todo.id %}" class="list-group-item list-group-item-action{% if todo.important %} list-group-item-danger{% endif %}"><b>{{ todo.title }}</b>{% if todo.memo %} - {{ todo.memo|truncatechars:30 }}{% endif %}</a>
19+
{% endfor %}
20+
</div>
21+
{% else %}
22+
<div class="text-center">
23+
<h2>Looks like you don't have any todos! Nice work.</h2>
24+
<br>
25+
<a role="button" class="btn btn-primary" href="{% url 'createtodo' %}">New Todo</a>
26+
</div>
27+
{% endif %}
28+
</div>
29+
</div>
30+
{% endblock %}

todo/templates/todo/home.html

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{% extends "todo/base.html" %}
2+
3+
{% block content %}
4+
<br>
5+
<br>
6+
<br>
7+
<br>
8+
<br>
9+
<br>
10+
<div class="row justify-content-center mt-5">
11+
<div class="col-md-7 text-center">
12+
13+
<h1>Simply Your Todos. Woo!</h1>
14+
<p>Life is fun. But life is also busy. There's a million different things you could be doing. But what matters is <u>what</u> you do. We created <b><i>Todo Woo</i></b> to help you make sense of all of your opportunities and live that life that matters most to you. Your new organized life awaits.</p>
15+
<a role="button" class="btn btn-primary btn-lg" href="{% url 'signupuser' %}">Start</a>
16+
</div>
17+
</div>
18+
19+
{% endblock %}

todo/templates/todo/loginuser.html

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{% extends "todo/base.html" %}
2+
3+
{% block content %}
4+
<div class="row justify-content-center mt-5">
5+
<div class="col-md-5">
6+
<h2>Login</h2>
7+
</div>
8+
</div>
9+
<div class="row justify-content-center mt-5">
10+
<div class="col-md-5">
11+
{% if error %}
12+
<div class="alert alert-danger" role="alert">
13+
{{ error }}
14+
</div>
15+
{% endif %}
16+
<form method="POST">
17+
{% csrf_token %}
18+
<div class="form-group">
19+
<label for="username">Username</label>
20+
<input type="text" name="username" class="form-control" id="username">
21+
</div>
22+
<div class="form-group">
23+
<label for="password">Password</label>
24+
<input type="password" name="password" class="form-control" id="password">
25+
</div>
26+
<button type="submit" class="btn btn-primary">Login</button>
27+
</form>
28+
<hr>
29+
<div class="text-center">
30+
Need an account? <a href="{% url 'signupuser' %}">Sign Up here</a>
31+
</div>
32+
</div>
33+
</div>
34+
{% endblock %}

todo/templates/todo/signupuser.html

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{% extends "todo/base.html" %}
2+
3+
{% block content %}
4+
<div class="row justify-content-center mt-5">
5+
<div class="col-md-5">
6+
<h2>Sign Up</h2>
7+
</div>
8+
</div>
9+
<div class="row justify-content-center mt-5">
10+
<div class="col-md-5">
11+
{% if error %}
12+
<div class="alert alert-danger" role="alert">
13+
{{ error }}
14+
</div>
15+
{% endif %}
16+
<form method="POST">
17+
{% csrf_token %}
18+
<div class="form-group">
19+
<label for="username">Username</label>
20+
<input type="text" name="username" class="form-control" id="username" aria-describedby="usernameHelp">
21+
<small id="usernameHelp" class="form-text text-muted">Your username must be unique. We'll let you know if someone has taken it already.</small>
22+
</div>
23+
<div class="form-group">
24+
<label for="password1">Password</label>
25+
<input type="password" name="password1" class="form-control" id="password1">
26+
</div>
27+
<div class="form-group">
28+
<label for="password2">Confirm Password</label>
29+
<input type="password" name="password2" class="form-control" id="password2">
30+
</div>
31+
<button type="submit" class="btn btn-primary">Sign Up</button>
32+
</form>
33+
<hr>
34+
<div class="text-center">
35+
Do you already have an account? <a href="{% url 'loginuser' %}">Login here</a>
36+
</div>
37+
</div>
38+
</div>
39+
{% endblock %}

0 commit comments

Comments
 (0)