Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #1

Open
wants to merge 52 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2f8cb24
Add new empty app task
vladislav-tsybuliak1 Sep 25, 2024
04c09f3
Add task to installed app, change time zone to Europe/Kiev
vladislav-tsybuliak1 Sep 25, 2024
de83d11
Add Task model
vladislav-tsybuliak1 Sep 25, 2024
57988ba
Add Tag model
vladislav-tsybuliak1 Sep 25, 2024
169a4c3
Add migrations for models
vladislav-tsybuliak1 Sep 25, 2024
310af15
Add urls for the task app
vladislav-tsybuliak1 Sep 25, 2024
9167f2b
Add path to index page to task/urls.py
vladislav-tsybuliak1 Sep 25, 2024
6ff206a
Add empty index view
vladislav-tsybuliak1 Sep 25, 2024
b89746e
Add base.html
vladislav-tsybuliak1 Sep 25, 2024
81b8bc9
Add empty index.html template
vladislav-tsybuliak1 Sep 25, 2024
0c98cb7
Add sidebar.html template to includes
vladislav-tsybuliak1 Sep 25, 2024
1f0ca6e
Include sidebar to base.html
vladislav-tsybuliak1 Sep 25, 2024
9844322
Register Task and Tag models to admin panel
vladislav-tsybuliak1 Sep 25, 2024
cf22f17
Alter content field for Task model, name field for Tag model, add new…
vladislav-tsybuliak1 Sep 25, 2024
f780f9d
Add str method for Task & Tag models
vladislav-tsybuliak1 Sep 25, 2024
bef83e8
Add django-debug-toolbar for development purposes
vladislav-tsybuliak1 Sep 25, 2024
f31d4d2
Add django-debug-toolbar to requirements.txt
vladislav-tsybuliak1 Sep 25, 2024
0439585
Add static files setting and empty styles.css
vladislav-tsybuliak1 Sep 25, 2024
d96b62e
Fix margin for body in html templates
vladislav-tsybuliak1 Sep 25, 2024
0741464
Alter tags field for task making it not required, edit index.html"
vladislav-tsybuliak1 Sep 25, 2024
0afec44
Fix index.html, fix N+1 problem
vladislav-tsybuliak1 Sep 25, 2024
7520139
Add ordering for tasks in meta class
vladislav-tsybuliak1 Sep 25, 2024
cbd7ea2
Add task create view and endpoint
vladislav-tsybuliak1 Sep 25, 2024
700d363
Add cripsy forms to installed apps
vladislav-tsybuliak1 Sep 25, 2024
0b1ba73
Add cripsy forms to requirements.txt
vladislav-tsybuliak1 Sep 25, 2024
cc6426d
Add Task create view and task form template
vladislav-tsybuliak1 Sep 25, 2024
f218b7a
Add 'create new task' button
vladislav-tsybuliak1 Sep 25, 2024
c0268ac
Add empty forms.py file
vladislav-tsybuliak1 Sep 25, 2024
a9df188
Add default value for is_coompleted field for Task model
vladislav-tsybuliak1 Sep 25, 2024
73d7931
Add Task form to forms.py, edit Task create view
vladislav-tsybuliak1 Sep 25, 2024
e962c9b
Add Task update view and update path to urls.py
vladislav-tsybuliak1 Sep 25, 2024
1524e97
Add Task delete view and path to urls.py
vladislav-tsybuliak1 Sep 25, 2024
95aff30
Add Task confirm delete template
vladislav-tsybuliak1 Sep 25, 2024
da78859
Add update and delete buttons to each task
vladislav-tsybuliak1 Sep 25, 2024
647e474
Add complete and undo buttons to each task, change index view
vladislav-tsybuliak1 Sep 25, 2024
f75f17c
Edit css style for index.html
vladislav-tsybuliak1 Sep 25, 2024
6751f81
Add Tag list view and path to urls.py
vladislav-tsybuliak1 Sep 25, 2024
0512556
Add bootstrap icons
vladislav-tsybuliak1 Sep 25, 2024
82bb035
Add Tag list template
vladislav-tsybuliak1 Sep 25, 2024
e3c61e4
Add link to the tags page to the sidebar
vladislav-tsybuliak1 Sep 25, 2024
0cb72d6
Add Tag create view, add path to tag create view in urls.py
vladislav-tsybuliak1 Sep 25, 2024
0ef58ce
Add tag form template, add link to add new tag to tag list template
vladislav-tsybuliak1 Sep 25, 2024
b405f83
Edit tag form template
vladislav-tsybuliak1 Sep 25, 2024
0db6ef6
Add Tag update view, add the link to tag list
vladislav-tsybuliak1 Sep 25, 2024
0409ad4
Add Tag delete view, add path to urls.py, add link to tag list template
vladislav-tsybuliak1 Sep 25, 2024
79ef333
Add Tag confirm delete template
vladislav-tsybuliak1 Sep 25, 2024
3e8b75c
Add icons instead of buttons for task deletion/updating
vladislav-tsybuliak1 Sep 25, 2024
2b47e18
Write README.md
vladislav-tsybuliak1 Sep 25, 2024
81d71b7
Add flake8 to requirements.txt
vladislav-tsybuliak1 Sep 25, 2024
86a3513
Fix style by PEP8, fix .html files style
vladislav-tsybuliak1 Sep 25, 2024
5425857
Fix comments
vladislav-tsybuliak1 Sep 28, 2024
b3dd9bc
Add migrations
vladislav-tsybuliak1 Sep 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
# TODO list
# TODO list 📝

# Shop Wise 🛒

This is a Django-based web application for managing tasks.

## Installation

Python3 must be already installed.

1. **Clone the repository:**
```bash
git clone https://github.com/vladislav-tsybuliak1/todo-list.git
cd django-todo-list
```

2. **Create a virtual environment and activate it:**
```bash
python -m venv env
source env/bin/activate # On Windows use `env\Scripts\activate`
```

3. **Install the dependencies:**
```bash
pip install -r requirements.txt
```

4. **Apply the migrations:**
```bash
python manage.py migrate
```

5. **Create a superuser:**
```bash
python manage.py createsuperuser
```

6. **Run the development server:**
```bash
python manage.py runserver
```

## Features

- Task listing, creation, update, and deletion
- Tag listing, creation, update, and deletion
- Managing tasks by completing them

## Contact

For any inquiries, please contact [[email protected]](mailto:[email protected]).

7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ asgiref==3.8.1
black==24.8.0
click==8.1.7
colorama==0.4.6
crispy-bootstrap5==2024.2
Django==5.1.1
django-crispy-forms==2.3
django-debug-toolbar==4.4.6
flake8==7.1.1
mccabe==0.7.0
mypy-extensions==1.0.0
packaging==24.1
pathspec==0.12.1
platformdirs==4.3.6
pycodestyle==2.12.1
pyflakes==3.2.0
sqlparse==0.5.1
tzdata==2024.2
11 changes: 11 additions & 0 deletions static/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
body {
margin-top: 20px;
}

.task {
transition: background-color 0.3s ease;
}

.task:hover {
background-color: ghostwhite;
}
Empty file added task/__init__.py
Empty file.
7 changes: 7 additions & 0 deletions task/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.contrib import admin

from task.models import Task, Tag


admin.site.register(Task)
admin.site.register(Tag)
6 changes: 6 additions & 0 deletions task/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class TaskConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "task"
24 changes: 24 additions & 0 deletions task/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from django import forms

from task.models import Tag, Task


class TaskForm(forms.ModelForm):
tags = forms.ModelMultipleChoiceField(
queryset=Tag.objects.all(),
widget=forms.CheckboxSelectMultiple,
required=False,
)

deadline_at = forms.DateTimeField(
widget=forms.DateTimeInput(attrs={"type": "datetime-local"}),
required=False
)

class Meta:
model = Task
fields = (
"content",
"deadline_at",
"tags"
)
47 changes: 47 additions & 0 deletions task/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Generated by Django 5.1.1 on 2024-09-25 07:46

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = []

operations = [
migrations.CreateModel(
name="Tag",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=255, unique=True)),
],
),
migrations.CreateModel(
name="Task",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("content", models.TextField()),
("created_at", models.DateTimeField(auto_now_add=True)),
("deadline_at", models.DateTimeField(blank=True, null=True)),
("is_completed", models.BooleanField()),
("tags", models.ManyToManyField(related_name="tasks", to="task.tag")),
],
),
]
23 changes: 23 additions & 0 deletions task/migrations/0002_alter_tag_name_alter_task_content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 5.1.1 on 2024-09-25 08:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("task", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name="tag",
name="name",
field=models.CharField(max_length=23, unique=True),
),
migrations.AlterField(
model_name="task",
name="content",
field=models.CharField(max_length=255),
),
]
20 changes: 20 additions & 0 deletions task/migrations/0003_alter_task_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.1.1 on 2024-09-25 09:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("task", "0002_alter_tag_name_alter_task_content"),
]

operations = [
migrations.AlterField(
model_name="task",
name="tags",
field=models.ManyToManyField(
null=True, related_name="tasks", to="task.tag"
),
),
]
20 changes: 20 additions & 0 deletions task/migrations/0004_alter_task_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.1.1 on 2024-09-25 09:43

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("task", "0003_alter_task_tags"),
]

operations = [
migrations.AlterField(
model_name="task",
name="tags",
field=models.ManyToManyField(
blank=True, null=True, related_name="tasks", to="task.tag"
),
),
]
17 changes: 17 additions & 0 deletions task/migrations/0005_alter_task_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 5.1.1 on 2024-09-25 09:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("task", "0004_alter_task_tags"),
]

operations = [
migrations.AlterModelOptions(
name="task",
options={"ordering": ("is_completed", "-created_at")},
),
]
18 changes: 18 additions & 0 deletions task/migrations/0006_alter_task_is_completed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.1.1 on 2024-09-25 10:17

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("task", "0005_alter_task_options"),
]

operations = [
migrations.AlterField(
model_name="task",
name="is_completed",
field=models.BooleanField(default=False),
),
]
18 changes: 18 additions & 0 deletions task/migrations/0007_alter_tag_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.1.1 on 2024-09-28 17:15

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("task", "0006_alter_task_is_completed"),
]

operations = [
migrations.AlterField(
model_name="tag",
name="name",
field=models.CharField(max_length=63, unique=True),
),
]
Empty file added task/migrations/__init__.py
Empty file.
30 changes: 30 additions & 0 deletions task/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from django.db import models


class Task(models.Model):
content = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
deadline_at = models.DateTimeField(null=True, blank=True)
is_completed = models.BooleanField(default=False)
tags = models.ManyToManyField(
to="Tag",
related_name="tasks",
null=True,
blank=True,
)

class Meta:
ordering = (
"is_completed",
"-created_at",
)

def __str__(self) -> str:
return self.content


class Tag(models.Model):
name = models.CharField(max_length=63, unique=True)

def __str__(self) -> str:
return self.name
3 changes: 3 additions & 0 deletions task/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
34 changes: 34 additions & 0 deletions task/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from django.urls import path

from task.views import (
index,
TaskCreateView,
TaskUpdateView,
TaskDeleteView,
TagListView,
TagCreateView,
TagUpdateView,
TagDeleteView,
)


urlpatterns = [
path("", index, name="index"),
path("tasks/create/", TaskCreateView.as_view(), name="task-create"),
path(
"tasks/<int:pk>/update/",
TaskUpdateView.as_view(),
name="task-update"
),
path(
"tasks/<int:pk>/delete/",
TaskDeleteView.as_view(),
name="task-delete"
),
path("tags/", TagListView.as_view(), name="tag-list"),
path("tags/create/", TagCreateView.as_view(), name="tag-create"),
path("tags/<int:pk>/update/", TagUpdateView.as_view(), name="tag-update"),
path("tags/<int:pk>/delete/", TagDeleteView.as_view(), name="tag-delete"),
]

app_name = "task"
Loading