Add simple tasks app.

main
KKlochko 2 years ago
parent 15b73b0dbf
commit 7cb8cf4c54

@ -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.

@ -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": [

@ -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),
]

@ -0,0 +1,5 @@
from django.contrib import admin
from .models import Task
admin.site.register(Task)

@ -0,0 +1,7 @@
from django.apps import AppConfig
class TasksConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "tasks"

@ -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,
),
),
],
),
]

@ -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

@ -0,0 +1,2 @@
from django.test import TestCase

@ -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'),
]

@ -0,0 +1,6 @@
from django.shortcuts import render
def index(request):
context = {}
return render(request, 'tasks/index.html', context)

@ -0,0 +1,15 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Simple TODO List{% endblock %}</title>
</head>
<body>
<div>
{% block content %}
{% endblock %}
</div>
</body>
</html>

@ -0,0 +1,6 @@
{% extends 'base.html' %}
{% load static %}
{% block content %}
<center><h1>Tasks</h1></center>
{% endblock %}
Loading…
Cancel
Save