master d798a5917279 cached
28 files
23.2 KB
6.4k tokens
23 symbols
1 requests
Download .txt
Repository: divanov11/Django-To-Do-list-with-user-authentication
Branch: master
Commit: d798a5917279
Files: 28
Total size: 23.2 KB

Directory structure:
gitextract_eb3yuwfd/

├── .gitignore
├── Pipfile
├── README.md
├── base/
│   ├── __init__.py
│   ├── admin.py
│   ├── apps.py
│   ├── forms.py
│   ├── migrations/
│   │   ├── 0001_initial.py
│   │   ├── 0002_auto_20210322_2234.py
│   │   └── __init__.py
│   ├── models.py
│   ├── templates/
│   │   └── base/
│   │       ├── login.html
│   │       ├── main.html
│   │       ├── register.html
│   │       ├── task.html
│   │       ├── task_confirm_delete.html
│   │       ├── task_form.html
│   │       └── task_list.html
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── db.sqlite3
├── manage.py
└── todo_list/
    ├── __init__.py
    ├── asgi.py
    ├── settings.py
    ├── urls.py
    └── wsgi.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py

media

# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
# in your Git repository. Update and uncomment the following line accordingly.
# <django-project-name>/staticfiles/

### Django.Python Stack ###
# Byte-compiled / optimized / DLL files
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
pytestdebug.log

# Translations
*.mo

# Django stuff:

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
doc/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
#   However, in case of collaboration, if having platform-specific dependencies or dependencies
#   having no cross-platform support, pipenv may install dependencies that don't work, or not
#   install all needed dependencies.
#Pipfile.lock

# poetry
#poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
# .env
.env/
.venv/
env/
venv/
ENV/
env.bak/
venv.bak/
pythonenv*

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# operating system-related files
*.DS_Store #file properties cache/storage on macOS
Thumbs.db #thumbnail cache on Windows

# profiling data
.prof


================================================
FILE: Pipfile
================================================
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
django = "*"

[requires]
python_version = "3.8"


================================================
FILE: README.md
================================================
# Django-To-Do-list-with-user-authentication
To Do list app with User Registration, Login, Search and full Create Read Update and DELETE functionality.

![DEMO](../master/Django%20To%20Do%20List%20App.jpg)


================================================
FILE: base/__init__.py
================================================


================================================
FILE: base/admin.py
================================================
from django.contrib import admin
from .models import Task

admin.site.register(Task)


================================================
FILE: base/apps.py
================================================
from django.apps import AppConfig


class BaseConfig(AppConfig):
    name = 'base'


================================================
FILE: base/forms.py
================================================
from django import forms

# Reordering Form and View


class PositionForm(forms.Form):
    position = forms.CharField()


================================================
FILE: base/migrations/0001_initial.py
================================================
# Generated by Django 3.1.7 on 2021-03-22 16:37

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='Task',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('description', models.TextField(blank=True, null=True)),
                ('complete', models.BooleanField(default=False)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-complete'],
            },
        ),
    ]


================================================
FILE: base/migrations/0002_auto_20210322_2234.py
================================================
# Generated by Django 3.1.7 on 2021-03-22 17:04

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('base', '0001_initial'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='task',
            options={},
        ),
        migrations.AlterOrderWithRespectTo(
            name='task',
            order_with_respect_to='user',
        ),
    ]


================================================
FILE: base/migrations/__init__.py
================================================


================================================
FILE: base/models.py
================================================
from django.db import models
from django.contrib.auth.models import User
# Create your models here.


class Task(models.Model):
    user = models.ForeignKey(
        User, on_delete=models.CASCADE, null=True, blank=True)
    title = models.CharField(max_length=200)
    description = models.TextField(null=True, blank=True)
    complete = models.BooleanField(default=False)
    created = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.title

    class Meta:
        order_with_respect_to = 'user'


================================================
FILE: base/templates/base/login.html
================================================
{% extends 'base/main.html' %}
{% block content %}

<div class="header-bar">
    <h1>Login</h1>
</div>

<div class="card-body">
    <form method="POST">
        {% csrf_token %}
        {{form.as_p}}
        <input class="button" type="submit" value="Login">
    </form>
    <p>Don't have an account? <a href="{% url 'register' %}">Register</a></p>
</div>






{% endblock content %}

================================================
FILE: base/templates/base/main.html
================================================
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="description"
        content="This is to do list implemented using Django by Dennis Ivy who is a full stack web developer.">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>To Do Items</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@200&display=swap" rel="stylesheet">

    <style>
        body {
            background-color: #FAFAFA;
            font-family: 'Nunito', sans-serif;
            padding-top: 50px;
        }

        h1,
        h2,
        h3,
        h4,
        h5,
        h6,
            {
            font-family: 'Raleway', sans-serif;
        }

        a,
        p {
            color: #4b5156
        }

        a {
            font-weight: 600;
        }

        .container {
            max-width: 550px;
            margin: auto;
            background-color: #fff;
            -webkit-box-shadow: 2px 2px 13px -4px rgba(0, 0, 0, 0.21);
            box-shadow: 2px 2px 13px -4px rgba(0, 0, 0, 0.21);
        }

        input {
            outline: none;
            border: none;
        }

        .header-bar {
            display: flex;
            justify-content: space-between;
            color: #fff;
            padding: 10px;
            border-radius: 5px 5px 0 0;
            background: linear-gradient(90deg, #EEA390 0%, #EB796F 43%, #EB796F 100%);
        }

        .header-bar a {
            color: rgb(247, 247, 247);
            text-decoration: none;
        }

        .task-wrapper {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background-color: #fff;
            border-top: 1px solid #dfe4ea;
            overflow: hidden;
        }

        .task-title {
            display: flex;
            padding: 20px;
        }

        .task-title a {
            text-decoration: none;
            color: #4b5156;
            margin-left: 10px;
        }

        .task-complete-icon {
            height: 20px;
            width: 20px;
            background-color: rgb(105, 192, 105);
            border-radius: 50%;
        }

        .task-incomplete-icon {
            height: 20px;
            width: 20px;
            background-color: rgb(218, 218, 218);
            border-radius: 50%;
        }

        .delete-link {
            text-decoration: none;
            font-weight: 900;
            color: #cf4949;
            font-size: 22px;
            line-height: 0;
            padding: 20px 0px;
        }

        /*Handle Classes*/

        .handle {
            display: inline-block;
            padding: 20px 16px;
            cursor: grab;
            user-select: none;
        }

        .handle:after,
        .handle:before {
            display: block;
            content: "";
        }

        .handle:active,
        .handle:active:before,
        .handle:active:after {
            cursor: grabbing;
        }

        .dropArea {
            background-color: #f1f2f6;
            color: black;
            border: #ced6e0 1px solid;
        }

        .selectedTask {
            opacity: 0.6;
        }


        #add-link {
            color: #EB796F;
            text-decoration: none;
            font-size: 42px;
            text-shadow: 1px 1px #81413b;
        }

        #search-add-wrapper {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px;
        }

        @media screen and (max-width:320px) {
            #search-add-wrapper {
                padding: 10px;
            }
        }

        input[type=text],
        input[type=password],
        textarea {
            border: 1px solid #757575;
            border-radius: 5px;
            padding: 10px;
            width: 90%;
        }

        label {
            padding-top: 10px !important;
            display: block;
        }

        ::placeholder {
            font-weight: 300;
            opacity: 0.5;
        }

        .button {
            border: 1px solid #757575;
            background-color: #FFF;
            color: #EB796F;
            padding: 10px;
            font-size: 14px;
            border-radius: 5px;
            cursor: pointer;
            text-decoration: none;
        }

        .card-body {
            padding: 20px;
        }
    </style>
</head>

<body>

    <div class="container">
        {% block content %} {% endblock content %}
    </div>

</body>


</html>

================================================
FILE: base/templates/base/register.html
================================================
{% extends 'base/main.html' %}
{% block content %}

<div class="header-bar">
    <h1>Register</h1>
</div>

<div class="card-body">
    <form method="POST">
        {% csrf_token %}
        <label>{{form.username.label}}</label>
        {{form.username}}

        <label>{{form.password1.label}}</label>
        {{form.password1}}

        <label>{{form.password2.label}}</label>
        {{form.password2}}
        <input style="margin-top:10px ;" class="button" type="submit" value="Register">
    </form>
    <p>Already have an account? <a href="{% url 'login' %}">Login</a></p>
</div>




{% endblock content %}

================================================
FILE: base/templates/base/task.html
================================================
<h1>Task: {{task}}</h1>

================================================
FILE: base/templates/base/task_confirm_delete.html
================================================
{% extends 'base/main.html' %}
{% block content %}

<div class="header-bar">
    <a href="{% url 'tasks' %}">&#8592; Go Back</a>
</div>

<div class="card-body">
    <form method="POST">
        {% csrf_token %}
        <p>Are your sure you want to delete this task? <b>"{{task}}"</b> </p>
        <input class="button" type="submit" value="Delete" />
    </form>
</div>



{% endblock content %}

================================================
FILE: base/templates/base/task_form.html
================================================
{% extends 'base/main.html' %}
{% block content %}

<div class="header-bar">
    <a href="{% url 'tasks' %}">&#8592; Back</a>
</div>


<div class="card-body">
    <form method="POST" action="">
        {% csrf_token %}
        {{form.as_p}}
        <input class="button" type="submit" value="Submit">
    </form>
</div>


{% endblock content %}

================================================
FILE: base/templates/base/task_list.html
================================================
{% extends 'base/main.html' %} {% block content %}

<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
<div class="header-bar">
    <div>
        <h1>Hello {{request.user|title}}</h1>
        <h3 style="margin:0">You have <i>{{count}}</i> incomplete task{{ count|pluralize:"s" }}</h3>
    </div>

    {% if request.user.is_authenticated %}
    <a href="{% url 'logout' %}">Logout</a> {% else %}
    <a href="{% url 'login' %}">Login</a> {% endif %}
</div>


<div id="search-add-wrapper">
    <form method="GET" style="display: flex;">
        <input type='text' name='search-area' placeholder="Search your task" value="{{search_input}}">
        <input class="button" type="submit" value='Search'>
    </form>
    {% if tasks|length > 0 %}
    <a id="add-link" href="{% url 'task-create' %}">&#x2b;</a>
    {% endif %}
</div>


<!-- Hidden form. Form submits new item positions -->
<form style="display: none;" id="reorderForm" method="post" action="{% url 'task-reorder' %}">
    {% csrf_token %}
    <input type="hidden" id="positionInput" name="position">
</form>


<div id="tasklist" class="task-items-wrapper">
    {% for task in tasks %}
    <div class="task-wrapper" data-position="{{task.pk}}">
        <div class="task-title">
            {% if task.complete %}
            <div class="task-complete-icon"></div>
            <i><s><a href="{% url 'task-update' task.id %}">{{task}}</a></s></i> {% else %}
            <div class="task-incomplete-icon"></div>
            <a href="{% url 'task-update' task.id %}">{{task}}</a> {% endif %}
        </div>
        <div class="task-controls">
            <a class="delete-link" href="{% url 'task-delete' task.id %}">&#215;</a>
            <span class="handle">&nbsp;&#10247;</span>
        </div>
    </div>

    {% empty %}
    <div style="text-align: center; padding-bottom: 10px; line-height: 1em;">
        <h3>No new tasks are created.</h3>
        <h3>Create a <a style="text-decoration: none; color: #e53935;" href="{% url 'task-create' %}">New task</a> ! </h3>
    </div>
    {% endfor %}
</div>

<script>
    var taskList = document.getElementById("tasklist");
    var reorderForm = document.getElementById("reorderForm");
    var positionInput = document.getElementById("positionInput");

    let sortable = Sortable.create(taskList, {
        handle: '.handle',
        ghostClass: 'dropArea',
        chosenClass: 'selectedTask',

    });

    function reordering() {
        const rows = document.getElementsByClassName("task-wrapper");
        let pos = [];
        for (let row of rows) {
            pos.push(row.dataset.position);
        }
        console.log(pos.join(","))
        positionInput.value = pos.join(',');
        reorderForm.submit();
    }

    document.ondrop = reordering
</script>

{% endblock content %}

================================================
FILE: base/tests.py
================================================
from django.test import TestCase

# Create your tests here.


================================================
FILE: base/urls.py
================================================
from django.urls import path
from .views import TaskList, TaskDetail, TaskCreate, TaskUpdate, DeleteView, CustomLoginView, RegisterPage, TaskReorder
from django.contrib.auth.views import LogoutView

urlpatterns = [
    path('login/', CustomLoginView.as_view(), name='login'),
    path('logout/', LogoutView.as_view(next_page='login'), name='logout'),
    path('register/', RegisterPage.as_view(), name='register'),

    path('', TaskList.as_view(), name='tasks'),
    path('task/<int:pk>/', TaskDetail.as_view(), name='task'),
    path('task-create/', TaskCreate.as_view(), name='task-create'),
    path('task-update/<int:pk>/', TaskUpdate.as_view(), name='task-update'),
    path('task-delete/<int:pk>/', DeleteView.as_view(), name='task-delete'),
    path('task-reorder/', TaskReorder.as_view(), name='task-reorder'),
]


================================================
FILE: base/views.py
================================================
from django.shortcuts import render, redirect
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView, FormView
from django.urls import reverse_lazy

from django.contrib.auth.views import LoginView
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth import login

# Imports for Reordering Feature
from django.views import View
from django.shortcuts import redirect
from django.db import transaction

from .models import Task
from .forms import PositionForm


class CustomLoginView(LoginView):
    template_name = 'base/login.html'
    fields = '__all__'
    redirect_authenticated_user = True

    def get_success_url(self):
        return reverse_lazy('tasks')


class RegisterPage(FormView):
    template_name = 'base/register.html'
    form_class = UserCreationForm
    redirect_authenticated_user = True
    success_url = reverse_lazy('tasks')

    def form_valid(self, form):
        user = form.save()
        if user is not None:
            login(self.request, user)
        return super(RegisterPage, self).form_valid(form)

    def get(self, *args, **kwargs):
        if self.request.user.is_authenticated:
            return redirect('tasks')
        return super(RegisterPage, self).get(*args, **kwargs)


class TaskList(LoginRequiredMixin, ListView):
    model = Task
    context_object_name = 'tasks'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['tasks'] = context['tasks'].filter(user=self.request.user)
        context['count'] = context['tasks'].filter(complete=False).count()

        search_input = self.request.GET.get('search-area') or ''
        if search_input:
            context['tasks'] = context['tasks'].filter(
                title__contains=search_input)

        context['search_input'] = search_input

        return context


class TaskDetail(LoginRequiredMixin, DetailView):
    model = Task
    context_object_name = 'task'
    template_name = 'base/task.html'


class TaskCreate(LoginRequiredMixin, CreateView):
    model = Task
    fields = ['title', 'description', 'complete']
    success_url = reverse_lazy('tasks')

    def form_valid(self, form):
        form.instance.user = self.request.user
        return super(TaskCreate, self).form_valid(form)


class TaskUpdate(LoginRequiredMixin, UpdateView):
    model = Task
    fields = ['title', 'description', 'complete']
    success_url = reverse_lazy('tasks')


class DeleteView(LoginRequiredMixin, DeleteView):
    model = Task
    context_object_name = 'task'
    success_url = reverse_lazy('tasks')
    def get_queryset(self):
        owner = self.request.user
        return self.model.objects.filter(user=owner)

class TaskReorder(View):
    def post(self, request):
        form = PositionForm(request.POST)

        if form.is_valid():
            positionList = form.cleaned_data["position"].split(',')

            with transaction.atomic():
                self.request.user.set_task_order(positionList)

        return redirect(reverse_lazy('tasks'))


================================================
FILE: manage.py
================================================
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todo_list.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()


================================================
FILE: todo_list/__init__.py
================================================


================================================
FILE: todo_list/asgi.py
================================================
"""
ASGI config for todo_list project.

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todo_list.settings')

application = get_asgi_application()


================================================
FILE: todo_list/settings.py
================================================
"""
Django settings for todo_list project.

Generated by 'django-admin startproject' using Django 3.0.8.

For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'd)=^c7!0-oqjmqve%(bt+p#sq6x*ipz2keh741j*-@f@_)f!1t'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'base.apps.BaseConfig',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'todo_list.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'todo_list.wsgi.application'


# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

LOGIN_URL = 'login'

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'


================================================
FILE: todo_list/urls.py
================================================
"""todo_list URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('base.urls')),
]


================================================
FILE: todo_list/wsgi.py
================================================
"""
WSGI config for todo_list project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todo_list.settings')

application = get_wsgi_application()
Download .txt
gitextract_eb3yuwfd/

├── .gitignore
├── Pipfile
├── README.md
├── base/
│   ├── __init__.py
│   ├── admin.py
│   ├── apps.py
│   ├── forms.py
│   ├── migrations/
│   │   ├── 0001_initial.py
│   │   ├── 0002_auto_20210322_2234.py
│   │   └── __init__.py
│   ├── models.py
│   ├── templates/
│   │   └── base/
│   │       ├── login.html
│   │       ├── main.html
│   │       ├── register.html
│   │       ├── task.html
│   │       ├── task_confirm_delete.html
│   │       ├── task_form.html
│   │       └── task_list.html
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── db.sqlite3
├── manage.py
└── todo_list/
    ├── __init__.py
    ├── asgi.py
    ├── settings.py
    ├── urls.py
    └── wsgi.py
Download .txt
SYMBOL INDEX (23 symbols across 7 files)

FILE: base/apps.py
  class BaseConfig (line 4) | class BaseConfig(AppConfig):

FILE: base/forms.py
  class PositionForm (line 6) | class PositionForm(forms.Form):

FILE: base/migrations/0001_initial.py
  class Migration (line 8) | class Migration(migrations.Migration):

FILE: base/migrations/0002_auto_20210322_2234.py
  class Migration (line 6) | class Migration(migrations.Migration):

FILE: base/models.py
  class Task (line 6) | class Task(models.Model):
    method __str__ (line 14) | def __str__(self):
    class Meta (line 17) | class Meta:

FILE: base/views.py
  class CustomLoginView (line 21) | class CustomLoginView(LoginView):
    method get_success_url (line 26) | def get_success_url(self):
  class RegisterPage (line 30) | class RegisterPage(FormView):
    method form_valid (line 36) | def form_valid(self, form):
    method get (line 42) | def get(self, *args, **kwargs):
  class TaskList (line 48) | class TaskList(LoginRequiredMixin, ListView):
    method get_context_data (line 52) | def get_context_data(self, **kwargs):
  class TaskDetail (line 67) | class TaskDetail(LoginRequiredMixin, DetailView):
  class TaskCreate (line 73) | class TaskCreate(LoginRequiredMixin, CreateView):
    method form_valid (line 78) | def form_valid(self, form):
  class TaskUpdate (line 83) | class TaskUpdate(LoginRequiredMixin, UpdateView):
  class DeleteView (line 89) | class DeleteView(LoginRequiredMixin, DeleteView):
    method get_queryset (line 93) | def get_queryset(self):
  class TaskReorder (line 97) | class TaskReorder(View):
    method post (line 98) | def post(self, request):

FILE: manage.py
  function main (line 7) | def main():
Condensed preview — 28 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (26K chars).
[
  {
    "path": ".gitignore",
    "chars": 2306,
    "preview": "### Django ###\n*.log\n*.pot\n*.pyc\n__pycache__/\nlocal_settings.py\n\nmedia\n\n# If your build process includes running collect"
  },
  {
    "path": "Pipfile",
    "chars": 151,
    "preview": "[[source]]\nname = \"pypi\"\nurl = \"https://pypi.org/simple\"\nverify_ssl = true\n\n[dev-packages]\n\n[packages]\ndjango = \"*\"\n\n[re"
  },
  {
    "path": "README.md",
    "chars": 206,
    "preview": "# Django-To-Do-list-with-user-authentication\nTo Do list app with User Registration, Login, Search and full Create Read U"
  },
  {
    "path": "base/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "base/admin.py",
    "chars": 85,
    "preview": "from django.contrib import admin\nfrom .models import Task\n\nadmin.site.register(Task)\n"
  },
  {
    "path": "base/apps.py",
    "chars": 83,
    "preview": "from django.apps import AppConfig\n\n\nclass BaseConfig(AppConfig):\n    name = 'base'\n"
  },
  {
    "path": "base/forms.py",
    "chars": 120,
    "preview": "from django import forms\n\n# Reordering Form and View\n\n\nclass PositionForm(forms.Form):\n    position = forms.CharField()\n"
  },
  {
    "path": "base/migrations/0001_initial.py",
    "chars": 1050,
    "preview": "# Generated by Django 3.1.7 on 2021-03-22 16:37\n\nfrom django.conf import settings\nfrom django.db import migrations, mode"
  },
  {
    "path": "base/migrations/0002_auto_20210322_2234.py",
    "chars": 431,
    "preview": "# Generated by Django 3.1.7 on 2021-03-22 17:04\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration"
  },
  {
    "path": "base/migrations/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "base/models.py",
    "chars": 534,
    "preview": "from django.db import models\nfrom django.contrib.auth.models import User\n# Create your models here.\n\n\nclass Task(models."
  },
  {
    "path": "base/templates/base/login.html",
    "chars": 384,
    "preview": "{% extends 'base/main.html' %}\n{% block content %}\n\n<div class=\"header-bar\">\n    <h1>Login</h1>\n</div>\n\n<div class=\"card"
  },
  {
    "path": "base/templates/base/main.html",
    "chars": 4720,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <meta charset=\"utf-8\">\n    <meta name=\"description\"\n        content=\"This i"
  },
  {
    "path": "base/templates/base/register.html",
    "chars": 613,
    "preview": "{% extends 'base/main.html' %}\n{% block content %}\n\n<div class=\"header-bar\">\n    <h1>Register</h1>\n</div>\n\n<div class=\"c"
  },
  {
    "path": "base/templates/base/task.html",
    "chars": 23,
    "preview": "<h1>Task: {{task}}</h1>"
  },
  {
    "path": "base/templates/base/task_confirm_delete.html",
    "chars": 395,
    "preview": "{% extends 'base/main.html' %}\n{% block content %}\n\n<div class=\"header-bar\">\n    <a href=\"{% url 'tasks' %}\">&#8592; Go "
  },
  {
    "path": "base/templates/base/task_form.html",
    "chars": 344,
    "preview": "{% extends 'base/main.html' %}\n{% block content %}\n\n<div class=\"header-bar\">\n    <a href=\"{% url 'tasks' %}\">&#8592; Bac"
  },
  {
    "path": "base/templates/base/task_list.html",
    "chars": 2832,
    "preview": "{% extends 'base/main.html' %} {% block content %}\n\n<script src=\"https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable"
  },
  {
    "path": "base/tests.py",
    "chars": 60,
    "preview": "from django.test import TestCase\n\n# Create your tests here.\n"
  },
  {
    "path": "base/urls.py",
    "chars": 822,
    "preview": "from django.urls import path\nfrom .views import TaskList, TaskDetail, TaskCreate, TaskUpdate, DeleteView, CustomLoginVie"
  },
  {
    "path": "base/views.py",
    "chars": 3222,
    "preview": "from django.shortcuts import render, redirect\nfrom django.views.generic.list import ListView\nfrom django.views.generic.d"
  },
  {
    "path": "manage.py",
    "chars": 629,
    "preview": "#!/usr/bin/env python\n\"\"\"Django's command-line utility for administrative tasks.\"\"\"\nimport os\nimport sys\n\n\ndef main():\n "
  },
  {
    "path": "todo_list/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "todo_list/asgi.py",
    "chars": 395,
    "preview": "\"\"\"\nASGI config for todo_list project.\n\nIt exposes the ASGI callable as a module-level variable named ``application``.\n\n"
  },
  {
    "path": "todo_list/settings.py",
    "chars": 3145,
    "preview": "\"\"\"\nDjango settings for todo_list project.\n\nGenerated by 'django-admin startproject' using Django 3.0.8.\n\nFor more infor"
  },
  {
    "path": "todo_list/urls.py",
    "chars": 796,
    "preview": "\"\"\"todo_list URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n    https:"
  },
  {
    "path": "todo_list/wsgi.py",
    "chars": 395,
    "preview": "\"\"\"\nWSGI config for todo_list project.\n\nIt exposes the WSGI callable as a module-level variable named ``application``.\n\n"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the divanov11/Django-To-Do-list-with-user-authentication GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 28 files (23.2 KB), approximately 6.4k tokens, and a symbol index with 23 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!