Skip to content

Commit af7fbff

Browse files
fix: add django-todo-app as regular folder with all files
1 parent ced080a commit af7fbff

30 files changed

+1063
-1
lines changed

django-todo-app

Lines changed: 0 additions & 1 deletion
This file was deleted.

django-todo-app/.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*.pyo
5+
6+
# Virtual environment
7+
venv/
8+
9+
# Django stuff
10+
*.log
11+
db.sqlite3
12+
staticfiles/
13+
14+
# IDEs
15+
.vscode/
16+
.idea/
17+
*.sublime-project
18+
*.sublime-workspace
19+
20+
# OS
21+
.DS_Store
22+
Thumbs.db

django-todo-app/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Reza Khalili
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

django-todo-app/README.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Django To-Do App
2+
3+
A full-featured **Django To-Do List** application with user authentication, task management, and priority tracking. Designed for clean code, security, and scalability.
4+
5+
---
6+
7+
## 🚀 Features
8+
9+
- **User Authentication**
10+
Register, login, and logout functionality with Django's built-in auth system.
11+
12+
- **Task Management (CRUD)**
13+
- Create, read, update, delete tasks
14+
- Tasks are user-specific; each user can only access their own tasks
15+
16+
- **Task Attributes**
17+
- Title, Description, Priority (Low, Medium, High)
18+
- Completion status
19+
- Due date with validation (cannot be in the past)
20+
21+
- **User Feedback**
22+
- Success and error messages for all actions using Django messages framework
23+
24+
- **Security & Best Practices**
25+
- LoginRequiredMixin for views
26+
- UserPassesTestMixin to prevent unauthorized access
27+
- CSRF protection in all forms
28+
- Proper validation in forms
29+
30+
- **Responsive UI**
31+
- Modern design with Bootstrap 5
32+
- Unified form template for create/update tasks
33+
- Styled task list and homepage
34+
35+
- **Testing**
36+
- Unit tests for models, forms, and views
37+
- Permission tests to prevent users from accessing others' tasks
38+
39+
---
40+
41+
## 📦 Installation
42+
43+
1. Clone the repository:
44+
```
45+
git clone https://github.com/reza-khalili-dev/django-todo.git
46+
cd django-todo
47+
Create and activate virtual environment:
48+
49+
python -m venv venv
50+
source venv/bin/activate # On Windows: venv\Scripts\activate
51+
Install dependencies:
52+
53+
pip install -r requirements.txt
54+
Apply migrations:
55+
56+
python manage.py migrate
57+
Create a superuser (optional):
58+
59+
python manage.py createsuperuser
60+
Run the development server:
61+
62+
python manage.py runserver
63+
🧪 Running Tests
64+
Run all unit tests with:
65+
66+
python manage.py test
67+
🖌️ Code Quality
68+
Code formatted with Black
69+
70+
Imports sorted with isort
71+
72+
Linting with flake8
73+
74+
⚙️ Deployment
75+
Separate settings for development and production
76+
77+
Use PostgreSQL in production
78+
79+
Static files served via Whitenoise
80+
81+
Environment variables for sensitive data (SECRET_KEY, DEBUG, etc.)
82+
83+
Recommended deployment platforms: Render, Railway, or Fly.io
84+
85+
📂 Project Structure
86+
87+
django-todo/
88+
89+
├── config/ # Django project settings
90+
├── tasks/ # Main app for task management
91+
│ ├── migrations/
92+
│ ├── templates/
93+
│ ├── static/
94+
│ ├── forms.py
95+
│ ├── models.py
96+
│ ├── views.py
97+
│ ├── tests.py
98+
│ └── urls.py
99+
├── venv/
100+
├── manage.py
101+
└── requirements.txt
102+
103+
💡 Future Improvements
104+
Drag & drop task ordering
105+
106+
Task notifications/alerts
107+
108+
Export tasks (CSV/JSON)
109+
110+
REST API with Django REST Framework
111+
112+
Mobile-friendly interface
113+
114+
📄 License
115+
This project is licensed under the MIT License.

django-todo-app/config/__init__.py

Whitespace-only changes.

django-todo-app/config/asgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for config project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/5.2/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
15+
16+
application = get_asgi_application()

django-todo-app/config/settings.py

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
"""
2+
Django settings for config project.
3+
4+
Generated by 'django-admin startproject' using Django 5.2.5.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/5.2/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/5.2/ref/settings/
11+
"""
12+
13+
from pathlib import Path
14+
15+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
16+
BASE_DIR = Path(__file__).resolve().parent.parent
17+
18+
19+
# Quick-start development settings - unsuitable for production
20+
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = "django-insecure-s-h@yk8j=aboubja7i*c0@@$9vl=v90o%i6&ti05bq0+h9^g!i"
24+
25+
# SECURITY WARNING: don't run with debug turned on in production!
26+
DEBUG = True
27+
28+
ALLOWED_HOSTS = []
29+
30+
31+
# Application definition
32+
33+
INSTALLED_APPS = [
34+
"django.contrib.admin",
35+
"django.contrib.auth",
36+
"django.contrib.contenttypes",
37+
"django.contrib.sessions",
38+
"django.contrib.messages",
39+
"django.contrib.staticfiles",
40+
"tasks",
41+
]
42+
43+
MIDDLEWARE = [
44+
"django.middleware.security.SecurityMiddleware",
45+
"django.contrib.sessions.middleware.SessionMiddleware",
46+
"django.middleware.common.CommonMiddleware",
47+
"django.middleware.csrf.CsrfViewMiddleware",
48+
"django.contrib.auth.middleware.AuthenticationMiddleware",
49+
"django.contrib.messages.middleware.MessageMiddleware",
50+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
51+
]
52+
53+
ROOT_URLCONF = "config.urls"
54+
55+
TEMPLATES = [
56+
{
57+
"BACKEND": "django.template.backends.django.DjangoTemplates",
58+
"DIRS": [],
59+
"APP_DIRS": True,
60+
"OPTIONS": {
61+
"context_processors": [
62+
"django.template.context_processors.request",
63+
"django.contrib.auth.context_processors.auth",
64+
"django.contrib.messages.context_processors.messages",
65+
],
66+
},
67+
},
68+
]
69+
70+
WSGI_APPLICATION = "config.wsgi.application"
71+
72+
73+
LOGIN_REDIRECT_URL = "task_list" # For task list redirect
74+
LOGOUT_REDIRECT_URL = "login" # after logout user redirect to login page
75+
LOGIN_URL = "login" # if user is not login should redirect to login page
76+
77+
78+
# Database
79+
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
80+
81+
DATABASES = {
82+
"default": {
83+
"ENGINE": "django.db.backends.sqlite3",
84+
"NAME": BASE_DIR / "db.sqlite3",
85+
}
86+
}
87+
88+
89+
# Password validation
90+
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
91+
92+
AUTH_PASSWORD_VALIDATORS = [
93+
{
94+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
95+
},
96+
{
97+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
98+
},
99+
{
100+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
101+
},
102+
{
103+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
104+
},
105+
]
106+
107+
108+
# Internationalization
109+
# https://docs.djangoproject.com/en/5.2/topics/i18n/
110+
111+
LANGUAGE_CODE = "en-us"
112+
113+
TIME_ZONE = "UTC"
114+
115+
USE_I18N = True
116+
117+
USE_TZ = True
118+
119+
120+
# Static files (CSS, JavaScript, Images)
121+
# https://docs.djangoproject.com/en/5.2/howto/static-files/
122+
123+
STATIC_URL = "static/"
124+
STATICFILES_DRIS = [BASE_DIR / "static"] # for static files
125+
126+
# Default primary key field type
127+
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
128+
129+
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

django-todo-app/config/urls.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
URL configuration for config project.
3+
4+
The `urlpatterns` list routes URLs to views. For more information please see:
5+
https://docs.djangoproject.com/en/5.2/topics/http/urls/
6+
Examples:
7+
Function views
8+
1. Add an import: from my_app import views
9+
2. Add a URL to urlpatterns: path('', views.home, name='home')
10+
Class-based views
11+
1. Add an import: from other_app.views import Home
12+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
13+
Including another URLconf
14+
1. Import the include() function: from django.urls import include, path
15+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
16+
"""
17+
18+
from django.contrib import admin
19+
from django.urls import include, path
20+
21+
urlpatterns = [
22+
path("admin/", admin.site.urls),
23+
path("accounts/", include("django.contrib.auth.urls")),
24+
path("accounts/", include("tasks.urls")),
25+
path("", include("tasks.urls")),
26+
]

django-todo-app/config/wsgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for config project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/5.2/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
15+
16+
application = get_wsgi_application()

django-todo-app/manage.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
"""Run administrative tasks."""
9+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
10+
try:
11+
from django.core.management import execute_from_command_line
12+
except ImportError as exc:
13+
raise ImportError(
14+
"Couldn't import Django. Are you sure it's installed and "
15+
"available on your PYTHONPATH environment variable? Did you "
16+
"forget to activate a virtual environment?"
17+
) from exc
18+
execute_from_command_line(sys.argv)
19+
20+
21+
if __name__ == "__main__":
22+
main()

0 commit comments

Comments
 (0)