diff --git a/CHANGELOG.org b/CHANGELOG.org index dd145e7..0d48f4c 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -1,3 +1,6 @@ * Change Log ** 0.1.0 <2023-07-12 Wed> Init project. +** 0.2.0 <2023-07-12 Wed> + Add simple tasks app. + diff --git a/simple_todo_list/settings.py b/simple_todo_list/settings.py index bfc8f43..b2db815 100644 --- a/simple_todo_list/settings.py +++ b/simple_todo_list/settings.py @@ -24,6 +24,7 @@ ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ + "tasks", "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", @@ -47,7 +48,7 @@ ROOT_URLCONF = "simple_todo_list.urls" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [], + "DIRS": [BASE_DIR / "templates"], "APP_DIRS": True, "OPTIONS": { "context_processors": [ diff --git a/simple_todo_list/urls.py b/simple_todo_list/urls.py index 93bf91d..285b797 100644 --- a/simple_todo_list/urls.py +++ b/simple_todo_list/urls.py @@ -2,6 +2,7 @@ from django.contrib import admin from django.urls import include, path urlpatterns = [ + path('', include('tasks.urls')), path("admin/", admin.site.urls), ] diff --git a/tasks/__init__.py b/tasks/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tasks/admin.py b/tasks/admin.py new file mode 100644 index 0000000..6d853ad --- /dev/null +++ b/tasks/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin +from .models import Task + +admin.site.register(Task) + diff --git a/tasks/apps.py b/tasks/apps.py new file mode 100644 index 0000000..3093343 --- /dev/null +++ b/tasks/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class TasksConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "tasks" + diff --git a/tasks/migrations/0001_initial.py b/tasks/migrations/0001_initial.py new file mode 100644 index 0000000..7852aa6 --- /dev/null +++ b/tasks/migrations/0001_initial.py @@ -0,0 +1,41 @@ +# Generated by Django 4.2.3 on 2023-07-12 17:15 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + initial = True + + dependencies = [] + + operations = [ + migrations.CreateModel( + name="Task", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=64)), + ("description", models.TextField(max_length=5000)), + ( + "status", + models.CharField( + choices=[ + ("TODO", "TODO"), + ("DOING", "DOING"), + ("DONE", "DONE"), + ("CANCELED", "CANCELED"), + ], + default="TODO", + max_length=8, + ), + ), + ], + ), + ] diff --git a/tasks/migrations/__init__.py b/tasks/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tasks/models.py b/tasks/models.py new file mode 100644 index 0000000..215fbda --- /dev/null +++ b/tasks/models.py @@ -0,0 +1,27 @@ +from django.db import models + +class Task(models.Model): + name = models.CharField(max_length=64) + description = models.TextField(max_length=5000) + + # Constants for status + TODO = "TODO" + DOING = "DOING" + DONE = "DONE" + CANCELED = "CANCELED" + STATUSES = [ + (TODO, "TODO"), + (DOING, "DOING"), + (DONE, "DONE"), + (CANCELED, "CANCELED"), + ] + + status = models.CharField( + max_length=8, + choices=STATUSES, + default=TODO, + ) + + def __str__(self): + return self.name + diff --git a/tasks/tests.py b/tasks/tests.py new file mode 100644 index 0000000..ef8d717 --- /dev/null +++ b/tasks/tests.py @@ -0,0 +1,2 @@ +from django.test import TestCase + diff --git a/tasks/urls.py b/tasks/urls.py new file mode 100644 index 0000000..9c583ff --- /dev/null +++ b/tasks/urls.py @@ -0,0 +1,10 @@ +from django.conf.urls import include +from django.urls import path + +from . import views + +app_name = 'polls' +urlpatterns = [ + path('', views.index, name='index'), +] + diff --git a/tasks/views.py b/tasks/views.py new file mode 100644 index 0000000..c976fd7 --- /dev/null +++ b/tasks/views.py @@ -0,0 +1,6 @@ +from django.shortcuts import render + +def index(request): + context = {} + return render(request, 'tasks/index.html', context) + diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..24fed01 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,15 @@ +{% load static %} + + + + + + {% block title %}Simple TODO List{% endblock %} + + +
+ {% block content %} + {% endblock %} +
+ + diff --git a/templates/tasks/index.html b/templates/tasks/index.html new file mode 100644 index 0000000..36c7e54 --- /dev/null +++ b/templates/tasks/index.html @@ -0,0 +1,6 @@ +{% extends 'base.html' %} +{% load static %} + +{% block content %} +

Tasks

+{% endblock %}