-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 361ef20
Showing
38 changed files
with
751 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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 @@ | ||
#!/usr/bin/env python | ||
"""Django's command-line utility for administrative tasks.""" | ||
import os | ||
import sys | ||
|
||
|
||
def main(): | ||
"""Run administrative tasks.""" | ||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todowoo.settings') | ||
try: | ||
from django.core.management import execute_from_command_line | ||
except ImportError as exc: | ||
raise ImportError( | ||
"Couldn't import Django. Are you sure it's installed and " | ||
"available on your PYTHONPATH environment variable? Did you " | ||
"forget to activate a virtual environment?" | ||
) from exc | ||
execute_from_command_line(sys.argv) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 | ||
from .models import TodoItem | ||
|
||
class TodoAdmin(admin.ModelAdmin): | ||
readonly_fields = ('created_at', ) | ||
|
||
admin.site.register(TodoItem, TodoAdmin) |
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 TodoConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'todo' |
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,12 @@ | ||
from django.forms import ModelForm | ||
from .models import TodoItem | ||
|
||
class TodoForm(ModelForm): | ||
|
||
class Meta: | ||
model = TodoItem | ||
fields = [ | ||
'name', | ||
'memo', | ||
'is_important', | ||
] |
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,29 @@ | ||
# Generated by Django 3.2.6 on 2021-08-18 19:04 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='TodoItem', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=100)), | ||
('memo', models.TextField(blank=True)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('date_completed', models.DateTimeField(null=True)), | ||
('is_important', models.BooleanField(default=False)), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
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,18 @@ | ||
# Generated by Django 3.2.6 on 2021-08-18 19:06 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('todo', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='todoitem', | ||
name='date_completed', | ||
field=models.DateTimeField(blank=True, null=True), | ||
), | ||
] |
Empty file.
Binary file not shown.
Binary file added
BIN
+606 Bytes
todo/migrations/__pycache__/0002_alter_todoitem_date_completed.cpython-39.pyc
Binary file not shown.
Binary file not shown.
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,14 @@ | ||
from django.db import models | ||
from django.contrib.auth.models import User | ||
|
||
class TodoItem(models.Model): | ||
name = models.CharField(max_length = 100) | ||
memo = models.TextField(blank=True) | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
date_completed = models.DateTimeField(null=True, blank=True) | ||
is_important = models.BooleanField(default=False) | ||
|
||
user = models.ForeignKey(User, on_delete=models.CASCADE) | ||
|
||
def __str__(self): | ||
return str(self.id) + ' ' + self.name |
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,63 @@ | ||
<!doctype html> | ||
{% load static %} | ||
<html lang="en"> | ||
<head> | ||
<!-- Required meta tags --> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<!-- Bootstrap CSS --> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous"> | ||
|
||
<title>Plan for today</title> | ||
|
||
<style> | ||
|
||
</style> | ||
|
||
</head> | ||
<body> | ||
|
||
{% if user.is_authenticated %} | ||
<div class="alert alert-success" role="alert"> | ||
Things to accomplish for | ||
<strong>{{ user.username }}</strong> | ||
</div> | ||
{% endif %} | ||
|
||
|
||
<ul class="nav justify-content-center"> | ||
|
||
<li class="nav-item"><a class="nav-link active" aria-current="page" href="/">Home</a></li> | ||
|
||
{% if user.is_authenticated %} | ||
<li class="nav-item"><a class="nav-link active" aria-current="page" href="{% url 'completed_todos' %}">Completed</a></li> | ||
<li class="nav-item"><a class="nav-link" aria-current="page" href="{% url 'current_todos' %}">Current items</a></li> | ||
{% endif %} | ||
|
||
{% if user.is_authenticated %} | ||
<form method="POST" action="{% url 'logout'%}" style="display: inline-block; margin-left: auto; margin-right: 20px"> | ||
{% csrf_token %} | ||
<button type="submit" class="btn btn-primary">Logout</button> | ||
</form> | ||
|
||
{% else %} | ||
<li class="nav-item"><a class="nav-link active" aria-current="page" href="{% url 'login' %}">Login</a></li> | ||
<li class="nav-item"><a class="nav-link active" aria-current="page" href="{% url 'signupuser' %}">Sign Up</a></li> | ||
{% endif %} | ||
|
||
|
||
</ul> | ||
|
||
<!-- <img src="{% static 'portfolio/dino.jpg' %}" width="150" alt="dino"/> --> | ||
|
||
<div class="content m-5"> | ||
{% block content %}{% endblock %} | ||
</div> | ||
<!-- Optional JavaScript; choose one of the two! --> | ||
|
||
<!-- Option 1: Bootstrap Bundle with Popper --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script> | ||
|
||
</body> | ||
</html> |
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 @@ | ||
{% extends 'todo/base.html' %} | ||
{% block content %} | ||
|
||
|
||
<h1>COMPLETED</h1> | ||
<a class="btn btn-primary mb-5" href="{% url 'create_todo' %}">+ Create</a> | ||
|
||
<div class="list-group"> | ||
{% for itm in items %} | ||
<a href="{% url 'view_item' itm.id %}" class="list-group-item list-group-item-action {% if itm.is_important %}active{% endif %}"> | ||
#{{ itm.id }} - {{ itm.name }} | ||
{% if itm.memo %} | ||
<div><small>{{ itm.memo | truncatechars:100}}</small></div> | ||
<date>{{ itm.date_completed | date:"d M Y" }}</date> | ||
{% endif %} | ||
</a> | ||
{% endfor %} | ||
</div> | ||
|
||
{% endblock %} |
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,18 @@ | ||
{% extends 'todo/base.html' %} | ||
{% block content %} | ||
|
||
|
||
<h1>Create a new entry</h1> | ||
|
||
<h3>{{ error }}</h3> | ||
|
||
<form method="POST"> | ||
|
||
{{ form.as_p }} | ||
{% csrf_token %} | ||
|
||
<button type="submit" class="btn btn-primary">Create</button> | ||
|
||
</form> | ||
|
||
{% endblock %} |
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,19 @@ | ||
{% extends 'todo/base.html' %} | ||
{% block content %} | ||
|
||
|
||
<h1>Todos list</h1> | ||
<a class="btn btn-primary mb-4" href="{% url 'create_todo' %}">+ Create</a> | ||
|
||
<div class="list-group"> | ||
{% for itm in items %} | ||
<a href="{% url 'view_item' itm.id %}" class="list-group-item list-group-item-action {% if itm.is_important %}active{% endif %}"> | ||
#{{ itm.id }} - {{ itm.name }} | ||
{% if itm.memo %} | ||
<div><small>{{ itm.memo | truncatechars:100}}</small></div> | ||
{% endif %} | ||
</a> | ||
{% endfor %} | ||
</div> | ||
|
||
{% endblock %} |
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,9 @@ | ||
{% extends 'todo/base.html' %} | ||
{% block content %} | ||
|
||
|
||
<h1>Home - all items</h1> | ||
<a class="btn btn-primary mb-5" href="{% url 'create_todo' %}">+ Create</a> | ||
|
||
|
||
{% endblock %} |
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 @@ | ||
{% extends 'todo/base.html' %} | ||
{% block content %} | ||
<style> | ||
form input, form textarea { | ||
display: block | ||
} | ||
</style> | ||
|
||
<h1>Log In</h1> | ||
|
||
<h3>{{ error }}</h3> | ||
|
||
<form method="POST"> | ||
|
||
{{ form.as_p }} | ||
{% csrf_token %} | ||
|
||
<button type="submit" class="btn btn-primary">Log In</button> | ||
|
||
</form> | ||
|
||
{% endblock %} |
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 @@ | ||
{% extends 'todo/base.html' %} | ||
{% block content %} | ||
<style> | ||
form input, form textarea { | ||
display: block | ||
} | ||
</style> | ||
|
||
<h1>Sign Up</h1> | ||
|
||
<h3>{{ error }}</h3> | ||
|
||
<form method="POST"> | ||
|
||
{{ form.as_p }} | ||
{% csrf_token %} | ||
|
||
<button type="submit" class="btn btn-primary">Sign Up</button> | ||
|
||
</form> | ||
|
||
{% endblock %} |
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,50 @@ | ||
{% extends 'todo/base.html' %} | ||
{% block content %} | ||
<style> | ||
form input, form textarea { | ||
display: block | ||
} | ||
</style> | ||
|
||
<h1>View</h1> | ||
|
||
<!-- | ||
{% if itm.is_important %} | ||
<h2>! IMPORTANT !</h2> | ||
{% endif %} | ||
<h5>ID: #{{ itm.id }}</h5> | ||
<h5>NAME: {{ itm.name }}</h5> | ||
{% if itm.memo %} | ||
<p><small>{{ itm.memo}}</small></p> | ||
{% endif %} | ||
--> | ||
<form method="POST"> | ||
|
||
{{ form.as_p }} | ||
{% csrf_token %} | ||
|
||
<button type="submit" class="btn btn-primary">Update</button> | ||
|
||
|
||
</form> | ||
<br/> | ||
|
||
<form method="POST" action={% url 'complete_item' itm.id %}> | ||
{% csrf_token %} | ||
<button type="submit" class="btn btn-success">Complete item</button> | ||
</form> | ||
|
||
<br/> | ||
|
||
|
||
|
||
<form method="POST" action={% url 'delete_item' itm.id %}> | ||
{% csrf_token %} | ||
<button type="submit" class="btn btn-danger">DELETE</button> | ||
</form> | ||
|
||
|
||
|
||
{% endblock %} |
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,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
Oops, something went wrong.