From 6810fc976a452936ea3c570da44960cf54f9c147 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Sat, 25 Jan 2025 00:47:31 +0100 Subject: [PATCH] initial commit --- .idea/.gitignore | 8 ++ .idea/TimeDispatcher.iml | 30 +++++ .idea/dataSources.xml | 20 +++ .idea/discord.xml | 14 ++ .idea/inspectionProfiles/Project_Default.xml | 26 ++++ .../inspectionProfiles/profiles_settings.xml | 6 + .idea/misc.xml | 7 + .idea/modules.xml | 8 ++ .idea/vcs.xml | 6 + TimeDispatcher/__init__.py | 0 TimeDispatcher/asgi.py | 16 +++ TimeDispatcher/settings.py | 125 ++++++++++++++++++ TimeDispatcher/urls.py | 24 ++++ TimeDispatcher/wsgi.py | 16 +++ dispatcher/__init__.py | 0 dispatcher/admin.py | 3 + dispatcher/apps.py | 6 + dispatcher/migrations/0001_initial.py | 40 ++++++ dispatcher/migrations/__init__.py | 0 dispatcher/models.py | 16 +++ dispatcher/tests.py | 3 + dispatcher/views.py | 5 + manage.py | 22 +++ templates/base.html | 10 ++ templates/dashboard.html | 1 + 25 files changed, 412 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/TimeDispatcher.iml create mode 100644 .idea/dataSources.xml create mode 100644 .idea/discord.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 TimeDispatcher/__init__.py create mode 100644 TimeDispatcher/asgi.py create mode 100644 TimeDispatcher/settings.py create mode 100644 TimeDispatcher/urls.py create mode 100644 TimeDispatcher/wsgi.py create mode 100644 dispatcher/__init__.py create mode 100644 dispatcher/admin.py create mode 100644 dispatcher/apps.py create mode 100644 dispatcher/migrations/0001_initial.py create mode 100644 dispatcher/migrations/__init__.py create mode 100644 dispatcher/models.py create mode 100644 dispatcher/tests.py create mode 100644 dispatcher/views.py create mode 100755 manage.py create mode 100644 templates/base.html create mode 100644 templates/dashboard.html diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/TimeDispatcher.iml b/.idea/TimeDispatcher.iml new file mode 100644 index 0000000..dfbc70c --- /dev/null +++ b/.idea/TimeDispatcher.iml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..c1d42a2 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,20 @@ + + + + + sqlite.xerial + true + org.sqlite.JDBC + jdbc:sqlite:$PROJECT_DIR$/db.sqlite3 + $ProjectFileDir$ + + + file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/xerial/sqlite-jdbc/3.45.1.0/sqlite-jdbc-3.45.1.0.jar + + + file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar + + + + + \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..104c42f --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..9a7d489 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,26 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..cc0b76b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4657f67 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/TimeDispatcher/__init__.py b/TimeDispatcher/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/TimeDispatcher/asgi.py b/TimeDispatcher/asgi.py new file mode 100644 index 0000000..9e92226 --- /dev/null +++ b/TimeDispatcher/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for TimeDispatcher 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/5.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'TimeDispatcher.settings') + +application = get_asgi_application() diff --git a/TimeDispatcher/settings.py b/TimeDispatcher/settings.py new file mode 100644 index 0000000..b415349 --- /dev/null +++ b/TimeDispatcher/settings.py @@ -0,0 +1,125 @@ +""" +Django settings for TimeDispatcher project. + +Generated by 'django-admin startproject' using Django 5.1.5. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/5.1/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-^*x5i_#=$9kuj6k^v0cy5dqefmzo%j*i&0w93i%!zmgsa_z)2z' + +# 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', + "dispatcher.apps.DispatcherConfig" +] + +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 = 'TimeDispatcher.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [BASE_DIR / 'templates'] + , + '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 = 'TimeDispatcher.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/5.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/5.1/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/5.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/5.1/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/TimeDispatcher/urls.py b/TimeDispatcher/urls.py new file mode 100644 index 0000000..08c09f2 --- /dev/null +++ b/TimeDispatcher/urls.py @@ -0,0 +1,24 @@ +""" +URL configuration for TimeDispatcher project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/5.1/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 + +from dispatcher import views + +urlpatterns = [ + path("", views.dashboard_view, name="dashboard") +] diff --git a/TimeDispatcher/wsgi.py b/TimeDispatcher/wsgi.py new file mode 100644 index 0000000..f58221d --- /dev/null +++ b/TimeDispatcher/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for TimeDispatcher 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/5.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'TimeDispatcher.settings') + +application = get_wsgi_application() diff --git a/dispatcher/__init__.py b/dispatcher/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dispatcher/admin.py b/dispatcher/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/dispatcher/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/dispatcher/apps.py b/dispatcher/apps.py new file mode 100644 index 0000000..8b4c088 --- /dev/null +++ b/dispatcher/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class DispatcherConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'dispatcher' diff --git a/dispatcher/migrations/0001_initial.py b/dispatcher/migrations/0001_initial.py new file mode 100644 index 0000000..396cdfe --- /dev/null +++ b/dispatcher/migrations/0001_initial.py @@ -0,0 +1,40 @@ +# Generated by Django 5.1.5 on 2025-01-24 23:46 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Parent', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('project_num', models.CharField(max_length=32)), + ('name', models.CharField(max_length=256)), + ], + ), + migrations.CreateModel( + name='Project', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=256)), + ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dispatcher.parent')), + ], + ), + migrations.CreateModel( + name='Task', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateField()), + ('duration', models.IntegerField(default=0)), + ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dispatcher.project')), + ], + ), + ] diff --git a/dispatcher/migrations/__init__.py b/dispatcher/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dispatcher/models.py b/dispatcher/models.py new file mode 100644 index 0000000..95d497b --- /dev/null +++ b/dispatcher/models.py @@ -0,0 +1,16 @@ +from django.db import models + +class Parent(models.Model): + project_num = models.CharField(max_length=32) + name = models.CharField(max_length=256) + + +class Project(models.Model): + parent = models.ForeignKey(Parent, on_delete=models.CASCADE) + name = models.CharField(max_length=256) + + +class Task(models.Model): + project = models.ForeignKey(Project, on_delete=models.CASCADE) + date = models.DateField(null=False) + duration = models.IntegerField(null=False, default=0) diff --git a/dispatcher/tests.py b/dispatcher/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/dispatcher/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/dispatcher/views.py b/dispatcher/views.py new file mode 100644 index 0000000..f297325 --- /dev/null +++ b/dispatcher/views.py @@ -0,0 +1,5 @@ +from django.shortcuts import render + + +def dashboard_view(request): + return render(request, "dashboard.html") \ No newline at end of file diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..181a28a --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'TimeDispatcher.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() diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..566549b --- /dev/null +++ b/templates/base.html @@ -0,0 +1,10 @@ + + + + + Title + + + + + \ No newline at end of file diff --git a/templates/dashboard.html b/templates/dashboard.html new file mode 100644 index 0000000..94d9808 --- /dev/null +++ b/templates/dashboard.html @@ -0,0 +1 @@ +{% extends "base.html" %}