From 03356a9a5cd0774a046e91535c0d288441b4400f Mon Sep 17 00:00:00 2001 From: Tejaswini Date: Fri, 8 Nov 2024 13:16:04 -0500 Subject: [PATCH 1/3] Signup page --- .idea/.gitignore | 3 - .idea/SynergyPro_Team5_CS-GY-6063.iml | 12 -- .../inspectionProfiles/profiles_settings.xml | 6 - .idea/misc.xml | 7 - .idea/modules.xml | 8 - .idea/vcs.xml | 6 - synergy_pro/.gitignore | 22 +++ synergy_pro/manage.py | 22 +++ .../synergy_pro}/__init__.py | 0 .../synergy_pro}/asgi.py | 4 +- synergy_pro/synergy_pro/settings.py | 143 ++++++++++++++++++ .../synergy_pro}/urls.py | 12 +- .../synergy_pro}/wsgi.py | 4 +- synergy_pro/tasks/__init__.py | 0 synergy_pro/tasks/admin.py | 3 + synergy_pro/tasks/apps.py | 6 + synergy_pro/tasks/migrations/__init__.py | 0 synergy_pro/tasks/models.py | 3 + synergy_pro/tasks/tests.py | 3 + synergy_pro/tasks/views.py | 3 + synergy_pro/templates/media/info-circle.svg | 4 + synergy_pro/templates/synergy_pro/base.html | 42 +++++ .../users/registration/logged_out.html | 10 ++ .../templates/users/registration/login.html | 26 ++++ .../templates/users/registration/signup.html | 98 ++++++++++++ synergy_pro/users/__init__.py | 0 synergy_pro/users/admin.py | 3 + synergy_pro/users/apps.py | 6 + synergy_pro/users/forms.py | 10 ++ synergy_pro/users/migrations/__init__.py | 0 synergy_pro/users/models.py | 3 + synergy_pro/users/tests.py | 3 + synergy_pro/users/urls.py | 10 ++ synergy_pro/users/views.py | 16 ++ .../__pycache__/__init__.cpython-312.pyc | Bin 194 -> 0 bytes .../__pycache__/settings.cpython-312.pyc | Bin 2609 -> 0 bytes .../__pycache__/urls.cpython-312.pyc | Bin 1152 -> 0 bytes .../__pycache__/views.cpython-312.pyc | Bin 704 -> 0 bytes .../__pycache__/wsgi.cpython-312.pyc | Bin 698 -> 0 bytes task_management/settings.py | 124 --------------- .../__pycache__/__init__.cpython-312.pyc | Bin 191 -> 188 bytes .../__pycache__/admin.cpython-312.pyc | Bin 235 -> 232 bytes task_manager/__pycache__/apps.cpython-312.pyc | Bin 508 -> 505 bytes .../__pycache__/forms.cpython-312.pyc | Bin 831 -> 828 bytes .../__pycache__/models.cpython-312.pyc | Bin 772 -> 769 bytes task_manager/__pycache__/urls.cpython-312.pyc | Bin 663 -> 660 bytes .../__pycache__/views.cpython-312.pyc | Bin 1815 -> 1812 bytes .../__pycache__/0001_initial.cpython-312.pyc | Bin 1167 -> 1164 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 202 -> 199 bytes 49 files changed, 448 insertions(+), 174 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/SynergyPro_Team5_CS-GY-6063.iml delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml create mode 100644 synergy_pro/.gitignore create mode 100755 synergy_pro/manage.py rename {task_management => synergy_pro/synergy_pro}/__init__.py (100%) rename {task_management => synergy_pro/synergy_pro}/asgi.py (71%) create mode 100644 synergy_pro/synergy_pro/settings.py rename {task_management => synergy_pro/synergy_pro}/urls.py (71%) rename {task_management => synergy_pro/synergy_pro}/wsgi.py (71%) create mode 100644 synergy_pro/tasks/__init__.py create mode 100644 synergy_pro/tasks/admin.py create mode 100644 synergy_pro/tasks/apps.py create mode 100644 synergy_pro/tasks/migrations/__init__.py create mode 100644 synergy_pro/tasks/models.py create mode 100644 synergy_pro/tasks/tests.py create mode 100644 synergy_pro/tasks/views.py create mode 100644 synergy_pro/templates/media/info-circle.svg create mode 100644 synergy_pro/templates/synergy_pro/base.html create mode 100644 synergy_pro/templates/users/registration/logged_out.html create mode 100644 synergy_pro/templates/users/registration/login.html create mode 100644 synergy_pro/templates/users/registration/signup.html create mode 100644 synergy_pro/users/__init__.py create mode 100644 synergy_pro/users/admin.py create mode 100644 synergy_pro/users/apps.py create mode 100644 synergy_pro/users/forms.py create mode 100644 synergy_pro/users/migrations/__init__.py create mode 100644 synergy_pro/users/models.py create mode 100644 synergy_pro/users/tests.py create mode 100644 synergy_pro/users/urls.py create mode 100644 synergy_pro/users/views.py delete mode 100644 task_management/__pycache__/__init__.cpython-312.pyc delete mode 100644 task_management/__pycache__/settings.cpython-312.pyc delete mode 100644 task_management/__pycache__/urls.cpython-312.pyc delete mode 100644 task_management/__pycache__/views.cpython-312.pyc delete mode 100644 task_management/__pycache__/wsgi.cpython-312.pyc delete mode 100644 task_management/settings.py diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/SynergyPro_Team5_CS-GY-6063.iml b/.idea/SynergyPro_Team5_CS-GY-6063.iml deleted file mode 100644 index 8b8c395..0000000 --- a/.idea/SynergyPro_Team5_CS-GY-6063.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index db8786c..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index d41cc08..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/synergy_pro/.gitignore b/synergy_pro/.gitignore new file mode 100644 index 0000000..5ccad55 --- /dev/null +++ b/synergy_pro/.gitignore @@ -0,0 +1,22 @@ +# Python +__pycache__/ +*.py[cod] +*.pyo +.Python +venv/ +.idea + +# Django +*.sqlite3 +db.sqlite3 + +# Environment variables +.env + +# Static files +/staticfiles/ +/media/ + +# macOS +.DS_Store + diff --git a/synergy_pro/manage.py b/synergy_pro/manage.py new file mode 100755 index 0000000..99d3d3e --- /dev/null +++ b/synergy_pro/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', 'synergy_pro.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/task_management/__init__.py b/synergy_pro/synergy_pro/__init__.py similarity index 100% rename from task_management/__init__.py rename to synergy_pro/synergy_pro/__init__.py diff --git a/task_management/asgi.py b/synergy_pro/synergy_pro/asgi.py similarity index 71% rename from task_management/asgi.py rename to synergy_pro/synergy_pro/asgi.py index 5823877..d99446a 100644 --- a/task_management/asgi.py +++ b/synergy_pro/synergy_pro/asgi.py @@ -1,5 +1,5 @@ """ -ASGI config for task_management project. +ASGI config for synergy_pro project. It exposes the ASGI callable as a module-level variable named ``application``. @@ -11,6 +11,6 @@ from django.core.asgi import get_asgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "task_management.settings") +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'synergy_pro.settings') application = get_asgi_application() diff --git a/synergy_pro/synergy_pro/settings.py b/synergy_pro/synergy_pro/settings.py new file mode 100644 index 0000000..b778ce4 --- /dev/null +++ b/synergy_pro/synergy_pro/settings.py @@ -0,0 +1,143 @@ +""" +Django settings for synergy_pro project. + +Generated by 'django-admin startproject' using Django 5.1.2. + +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 +from django.contrib.messages import constants as messages + +# 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-)n3+q*ucge#o3rx_0^!8+@51cfj%8$yjw)sq^d+wx+!3(xe)!a' + +# 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', + 'crispy_forms', + 'users', + 'tasks', +] + +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 = 'synergy_pro.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', + ], + }, + }, +] +# CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" +# CRISPY_TEMPLATE_PACK = "bootstrap5" + + +WSGI_APPLICATION = 'synergy_pro.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/' +STATICFILES_DIRS = [BASE_DIR / "static"] + +MEDIA_URL = '/media/' +MEDIA_ROOT = BASE_DIR / "media" + +# Default primary key field type +# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +LOGIN_REDIRECT_URL = '/' # Redirects to the home page after login +LOGOUT_REDIRECT_URL = '/users/login/' # Redirects to the login page after logout + +MESSAGE_TAGS = { + messages.SUCCESS: 'alert-success', + messages.ERROR: 'alert-danger', +} + diff --git a/task_management/urls.py b/synergy_pro/synergy_pro/urls.py similarity index 71% rename from task_management/urls.py rename to synergy_pro/synergy_pro/urls.py index 43d4a8a..e2f39b9 100644 --- a/task_management/urls.py +++ b/synergy_pro/synergy_pro/urls.py @@ -1,5 +1,5 @@ """ -URL configuration for task_management project. +URL configuration for synergy_pro project. The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/5.1/topics/http/urls/ @@ -14,11 +14,15 @@ 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 +from django.shortcuts import render + +def home(request): + return render(request, 'synergy_pro/base.html') urlpatterns = [ - path("admin/", admin.site.urls), - path('', include('task_manager.urls')), + path('admin/', admin.site.urls), + path('users/', include('users.urls')), + path('', home, name='home'), # Root URL pattern ] diff --git a/task_management/wsgi.py b/synergy_pro/synergy_pro/wsgi.py similarity index 71% rename from task_management/wsgi.py rename to synergy_pro/synergy_pro/wsgi.py index 1b401c1..a472c2e 100644 --- a/task_management/wsgi.py +++ b/synergy_pro/synergy_pro/wsgi.py @@ -1,5 +1,5 @@ """ -WSGI config for task_management project. +WSGI config for synergy_pro project. It exposes the WSGI callable as a module-level variable named ``application``. @@ -11,6 +11,6 @@ from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "task_management.settings") +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'synergy_pro.settings') application = get_wsgi_application() diff --git a/synergy_pro/tasks/__init__.py b/synergy_pro/tasks/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/synergy_pro/tasks/admin.py b/synergy_pro/tasks/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/synergy_pro/tasks/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/synergy_pro/tasks/apps.py b/synergy_pro/tasks/apps.py new file mode 100644 index 0000000..3ff3ab3 --- /dev/null +++ b/synergy_pro/tasks/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class TasksConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'tasks' diff --git a/synergy_pro/tasks/migrations/__init__.py b/synergy_pro/tasks/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/synergy_pro/tasks/models.py b/synergy_pro/tasks/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/synergy_pro/tasks/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/synergy_pro/tasks/tests.py b/synergy_pro/tasks/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/synergy_pro/tasks/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/synergy_pro/tasks/views.py b/synergy_pro/tasks/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/synergy_pro/tasks/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/synergy_pro/templates/media/info-circle.svg b/synergy_pro/templates/media/info-circle.svg new file mode 100644 index 0000000..e2b50eb --- /dev/null +++ b/synergy_pro/templates/media/info-circle.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/synergy_pro/templates/synergy_pro/base.html b/synergy_pro/templates/synergy_pro/base.html new file mode 100644 index 0000000..93c6b79 --- /dev/null +++ b/synergy_pro/templates/synergy_pro/base.html @@ -0,0 +1,42 @@ + + + + + + {% block title %}Synergy Pro{% endblock %} + + + + + + +
+ + +
+ + +
+

Welcome to Synergy Pro

+ {% block content %}{% endblock %} +
+ + + + + + diff --git a/synergy_pro/templates/users/registration/logged_out.html b/synergy_pro/templates/users/registration/logged_out.html new file mode 100644 index 0000000..0c83d9c --- /dev/null +++ b/synergy_pro/templates/users/registration/logged_out.html @@ -0,0 +1,10 @@ +{% extends "synergy_pro/base.html" %} + +{% block title %}Logged Out{% endblock %} + +{% block content %} +
+

You have been logged out successfully

+

Click here to log in again

+
+{% endblock %} diff --git a/synergy_pro/templates/users/registration/login.html b/synergy_pro/templates/users/registration/login.html new file mode 100644 index 0000000..e3e3844 --- /dev/null +++ b/synergy_pro/templates/users/registration/login.html @@ -0,0 +1,26 @@ +{% extends "synergy_pro/base.html" %} + +{% block title %}Login{% endblock %} + +{% block content %} +
+

Login

+
+ {% csrf_token %} +
+ + +
+
+ + +
+ +
+ {% if form.errors %} +
+ Invalid username or password. Please try again. +
+ {% endif %} +
+{% endblock %} diff --git a/synergy_pro/templates/users/registration/signup.html b/synergy_pro/templates/users/registration/signup.html new file mode 100644 index 0000000..e31b2a0 --- /dev/null +++ b/synergy_pro/templates/users/registration/signup.html @@ -0,0 +1,98 @@ +{% extends "synergy_pro/base.html" %} +{% load crispy_forms_tags %} + +{% block title %}Sign Up{% endblock %} + +{% block content %} +
+
+

Sign Up

+ + {% if messages %} + {% for message in messages %} + + {% endfor %} + {% endif %} + +
+ {% csrf_token %} +
+
+
+
+ +
+
+
+ {{ form.username }} +
+
+ +
+
+
+ + +
+
+
+ {{ form.email }} +
+
+ +
+
+
+ +
+
+
+
+ {{ form.password1 }} +
+
+ + + + +
+
+
+ +
+
+
+ + +
+
+
+ {{ form.password2 }} +
+
+ + +
+ +
+
+
+ + +{% endblock %} diff --git a/synergy_pro/users/__init__.py b/synergy_pro/users/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/synergy_pro/users/admin.py b/synergy_pro/users/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/synergy_pro/users/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/synergy_pro/users/apps.py b/synergy_pro/users/apps.py new file mode 100644 index 0000000..72b1401 --- /dev/null +++ b/synergy_pro/users/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class UsersConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'users' diff --git a/synergy_pro/users/forms.py b/synergy_pro/users/forms.py new file mode 100644 index 0000000..a0b8387 --- /dev/null +++ b/synergy_pro/users/forms.py @@ -0,0 +1,10 @@ +from django import forms +from django.contrib.auth.models import User +from django.contrib.auth.forms import UserCreationForm + +class UserRegisterForm(UserCreationForm): + email = forms.EmailField(required=True) + + class Meta: + model = User + fields = ['username', 'email', 'password1', 'password2'] diff --git a/synergy_pro/users/migrations/__init__.py b/synergy_pro/users/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/synergy_pro/users/models.py b/synergy_pro/users/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/synergy_pro/users/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/synergy_pro/users/tests.py b/synergy_pro/users/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/synergy_pro/users/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/synergy_pro/users/urls.py b/synergy_pro/users/urls.py new file mode 100644 index 0000000..2e317d6 --- /dev/null +++ b/synergy_pro/users/urls.py @@ -0,0 +1,10 @@ +from django.urls import path +from django.contrib.auth import views as auth_views +from . import views + +urlpatterns = [ + path('login/', auth_views.LoginView.as_view(template_name='users/registration/login.html'), name='login'), + path('logout/', auth_views.LogoutView.as_view(template_name='users/registration/logged_out.html'), name='logout'), + path('signup/' ,views.signup, name='signup'), + # Add other views like registration here later +] diff --git a/synergy_pro/users/views.py b/synergy_pro/users/views.py new file mode 100644 index 0000000..c7f9969 --- /dev/null +++ b/synergy_pro/users/views.py @@ -0,0 +1,16 @@ +from django.shortcuts import render, redirect +from django.contrib.auth import login +from django.contrib import messages +from .forms import UserRegisterForm + +def signup(request): + if request.method == 'POST': + form = UserRegisterForm(request.POST) + if form.is_valid(): + user = form.save() + # login(request, user) # Automatically log the user in after signup + messages.success(request, "Account created successfully!") + return redirect('users/login.html') # Redirect to the homepage after signup + else: + form = UserRegisterForm() + return render(request, 'users/registration/signup.html', {'form': form}) diff --git a/task_management/__pycache__/__init__.cpython-312.pyc b/task_management/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index a63f91f1064d93310f3b965a997978f72712055e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 194 zcmX@j%ge<81bpYY(n0iN5P=Rpvj9b=GgLBYGWxA#C}INgK7-W!O4JW6PAw|dugp(R zEK1Bu%t_2H&dANwE!KC*PcF?(%_}L^ch4;GC{5B2uFOjJmt NkIamWj77{q768g$GXVeq diff --git a/task_management/__pycache__/settings.cpython-312.pyc b/task_management/__pycache__/settings.cpython-312.pyc deleted file mode 100644 index edbbef4452bf2bcae52615bb548acff14c1ab0b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2609 zcmb7G%X8C47?=FE{J=2=0<<$?7#^mLOa=&T2PlfI1P_kwMh+Am(8%76yonx0E0abi z-+Sq;J#gaI>7UVKFJyXv(J3>X9y-&5f$4=)KiN*=G0c?uq22u+zwg`cv8&%Q8IFO^ zpD!}{uW5$)BUl`KVw1_+zhUwtgBXQDED9N{8B#(l6Jl@(hks$mQd`LbwWINu$#iRE zEfD6XUta8LvVJnlJ5Sd@Ae(OD&f(n=O( zP!`9~F)zh1DEBNxSmhX+LwS&zL&rzY!svN|uzEzvp_9rSI;G^n-f{RB(7bX2omNin zo++NyuEVyt%9dv7HczqZ5=*E2rtR>qMz>W{vosx>*mC)vV{hS(D{$N@wy>kQ81e00 z{t_DLE@;Rk7EfKxaVL_O_&x zUdFas!r~1KVIC? zFKZXR+|+JAesX2A-M!{%xU2TJuP(MP^!iKo&Fuo&)QYVMoBH`tQGDmB&^aA&&UR=q z;$5DFd0$FExZT&iD<2{0;3v>WuJ_qQ_ONt=$bJAhh`4ucM))wAA5b{p6(fFpSuEd| z>J>jysjka@LTonG(JbC*wyKS~?9HB9!VcAmp!IqX^-)UwIKrD+-*68r9<`6+NS_$Q z#n(Izh?99ShLvce_XWUw^FrxNVvfACCa;ek?$}Z(@gZ-baXH zYoSm5@J6fb#o-2k_9=OvPGBLDrj4*cg=L~cd)X@l8>n79<;PVO4tG`c<2^V+4bpbP z5L!Q>s==`n&>c)|<0yr0+fmDb8FQ~r6xTT*Cju_-e|PcjrCf&QD5#G~$s-%`16$t>V zYm%xopkxvo;Ba;Ei@F~RW-SFgZvk>Su>cX{DfY zXld8hHAmah3~ifsO|n2s6}tn8uv}VNCGNd`yCmeLH11{kqrT- zz~n9t(!&H(kl0tb{HwzJewu&7M9*i3;dp_2olHk#!*Dhe8YG82Q&@Vzr67wU@i}IvUP_Omrl3hDjcKkyD1@5a=aFi{|v=o9V^+cyS{0N$3SLKfK7y%?~pB h>A692KXq)7*axR$!!(mU1&(se$s2o2-njs=_!nB!XgvS` diff --git a/task_management/__pycache__/urls.cpython-312.pyc b/task_management/__pycache__/urls.cpython-312.pyc deleted file mode 100644 index 1e2fc3034d2480c281f2183411c88e75d5945167..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1152 zcmb7E&ui2`7)`QCcbnQ)1;OK}$Zn*YSfvFQYmsVyfQZ-@aY54AWHy^^CKF~R>J~3v zq~7eQe}nW-@lxo?Ts(N{t)+PB$(d|I7eUZDOul^i=6&zInaQ`wNmCKy_;50KP*Ieh z@}(TrA~^dXf_=qT+KR9GTBKsFt*J7uL=~*Jb!@Z^RnZir`#RG4mr8((XMgGF&qBafjZ2U-vX^&8&s_t{3MFa&6m%BN8)Z6q!jXy#Gp$k;E-**7{)L_7{weU zl=P9uZPVQ7A+VLwD1n?K8nZ1Bg^UAAQjQo9Xbf-y-iGKMv%#`}!h|9a#sU=&@skKa zh5$pTWdbpJoF}a1I6m>1?e}3Ekg}aeu!CY}&YpERNkWe~ve*&rnPWbE53#^vEps`I zy_|a9HV2)x!DHVCFa{w`2<0sRx|Cpm2QEyKA~~d)*WWAZr2;8nM4?zJ#P%BX`b?p# zM=+WJF~n%0F5|joE=7>BW=9C~M^OL9g76-ql8Bu%F6pcatp8yn>utzf3DU6sV6+x{ zQR;_rAWX>nNojJYOMljKV}PI{wnx^Yh6TEXm93#&!|kx8;U&qUb|yFFpV@XI5;(%Z zvQu3qa@@LQnaA>kT54uMABVA}Wx8}cs}|KeV|m`ml$|RhCzIyupIhTu)pf<`aoudH zAS`rp8g{6-eo8hmqJruoLk*eMS;$eQOKsW2$bNrS&ctWs{Ef585M|DQ1dzf$jNmrw z;jqb^C&WwTwP4Ol$XC;jvp$Fs4F)eLaW@debMDf5bLDk&{_gyJXN0g^lOJ9?8JyQ1 zV&bO}dPFaaZt{+@1u>meR8>9Ird9pdO+~%&L%DrArWoV9*T2l|xAt25i+hVl`mOJJ cZTITuSBKXcN0Zi(e&@ufOluz}sQe}T2DZ^!j{pDw diff --git a/task_management/__pycache__/views.cpython-312.pyc b/task_management/__pycache__/views.cpython-312.pyc deleted file mode 100644 index 117f4801b78d6e75b1f169386c7279899ee5e5ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 704 zcmZ`%&uSAv7@tYfq)8iXnl^|PT@Y+@aAQ@Zf{18E@KA(U(Dty5J72P!?#`?;lP0@V z=)ni@){8Gty!ZsZfR}=oFdztC^rpm9PtL?zPkzk&`2PQ9zL}5JY6TfN`0%ZxF+yLh z@mF#u%D7>a14I$U5sL8^#)#%#qpe(;Zx+7Wq(iKW0vHA1n?HT<;Oq<=H~d(7BYuJs6TWiNN)F+$`$?BQfZ5kH7F#s3OoM<4*`nb$vqX@s0<> z1jK|!7b$cFfUflaQI+IQ7)9QyK2fggDTqlJWi(A;an6|bd&sJRA9;-NXLNa7n8mjz>AwMB|I~f} diff --git a/task_management/__pycache__/wsgi.cpython-312.pyc b/task_management/__pycache__/wsgi.cpython-312.pyc deleted file mode 100644 index e8e4d8f3a58f572e8ce2ca00a13d8aa33397cb73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 698 zcmZ8fL2DC16rS0{rfh5wvBl#cUIJz(wX_EjK}?OQnhHq~1G1UyzHBy~omqA!sp+jJ ze?otQ^rv{Rq9E)=MLc*@a_h<2q@ktnF!Q~6eDC|-%zRu~v5|@UpX}fmBlIgv7Lh*( z)1Cpx$VVOIW8dPqgUz1fR+Q`HFakVWUQjOfVetYlke~Ojomle>BMU+9jw z*_nIEM!HtpdEBh;x~=VYyV0z-+?Ttxy%*bux3AoSqd@CW1gcy}3$AOdxNd4mmEM>e zay&DKleJHBMldaa7>9`zscncp^x25(w0KGR1Da;e&fd~J1&N{)8L)&68E5-y5QP;* zYtkEKgD6@L^|Mirwk86SVDc)FZW~y%={{*y>TfDr)vXPB#qMl)C!U-wKb$|wqoici z%y&boYL>q_jPXCKfb-Lv2;0BW`VVBiw~y>^X!SE%JzaB7t2-Kam6(&5U7V4dsave?lAm0f To0?ZrtnZ##;!&D3F*O_jjVTq} diff --git a/task_manager/__pycache__/admin.cpython-312.pyc b/task_manager/__pycache__/admin.cpython-312.pyc index be3c5809a95b21a1b540f36a69b894d398f58d37..2783ec12b2402cbd6309b7dcd7d9a5cae01f8cfc 100644 GIT binary patch delta 62 zcmaFO_=1u9G%qg~0}#~D5}U{!uO6WvTAW%`tY4Cvl~`P!nU`5ylv$QoT#{IpsPB?m QoL!P%pdTFWI&n%k0CN}>o&W#< delta 65 zcmaFC_?nUXG%qg~0}%LJ;F`!CuNAEyTAW%`tY4X*o>-Kam6(&5U7V4dsave?lAm0f To0?ZrtnZ##;!&D3abh?Cs}2^4 diff --git a/task_manager/__pycache__/apps.cpython-312.pyc b/task_manager/__pycache__/apps.cpython-312.pyc index 9039902f59594e1ecd74c5984dd2d1b1390c0140..f3d19caba6c31e164ddc6b0d6bbc184781ffd8b4 100644 GIT binary patch delta 64 zcmeyv{F9mcG%qg~0}#~D65Gfv#Hb#wA6lGRRIFc;nw3~wo|%_fT$EXsSX`1=mZyU!Wfx?mF3>aVr3hTotPT delta 67 zcmey#{D+zQG%qg~0}%LJ;M&M7#HbaeA6lGRRIFc_pPpEhn3b55m|dKao2gr@?~jQeG}(o5D*(qI7M1`2 diff --git a/task_manager/__pycache__/forms.cpython-312.pyc b/task_manager/__pycache__/forms.cpython-312.pyc index f1f518b5fd31190896c577258bd400b04b831bb4..bcfeb3ebbfac5a8b6f445ff75256215b9eaa5c1e 100644 GIT binary patch delta 65 zcmdnbwug=TG%qg~0}#~D65Ggqo>4tQKeRZts93)wH7l{WJTot|xG1wMvA86$EK%Pj TwK%&Zzd%1Y+;uYxlQkm%sDu?- delta 68 zcmdnPwx5mrG%qg~0}yD7^K9fk&!`oxA6lGRRIFc_pPpEhn3b55m|dKao2gr@?~jQew3(5~nh^lCT@`Hr diff --git a/task_manager/__pycache__/models.cpython-312.pyc b/task_manager/__pycache__/models.cpython-312.pyc index afcf91f5b4b588aef4ba282be8c975795f51ef6d..6ebdea0d1d0d2c6bccf19c6d3038cf248819caca 100644 GIT binary patch delta 64 zcmZo+Yh>d-&CAQh00i~3#5QtYV^ojS4=qkDD%LMa%}OjT&&jQeG?|0xCjim57a9Nn diff --git a/task_manager/__pycache__/urls.cpython-312.pyc b/task_manager/__pycache__/urls.cpython-312.pyc index 030501d90fbfa0512313b07b7d1071775850ceae..b718708680664d0bd0d958a08a462b29cbcab17b 100644 GIT binary patch delta 64 zcmbQvI)#<{G%qg~0}#~D65GhVgHb(PKeRZts93)wH7l{WJTot|xG1wMvA86$EK%Pj SwK%&Zzd%1Y+;#F>##I1)Sr#S$ delta 67 zcmbQjI-QmKG%qg~0}zB=AsiA6lGRRIFc;nw3~wo|%_fT$EXsSX`1=mZyU!Wfx?z(v+V;U;}f#el$ delta 68 zcmbQjH=U3BG%qg~0}#|j@oeO-VbqG&4=qkDD%P*ePfsjL%u38j%r4Hz&D1T{cgasK W%}vcKDb{z-Eb%B!+Psc2jTHd5Sr$tG diff --git a/task_manager/migrations/__pycache__/0001_initial.cpython-312.pyc b/task_manager/migrations/__pycache__/0001_initial.cpython-312.pyc index 20566c06a4a42e5c7ee0cc58e28472675b5133d8..c4802844264eaa7bf1c105232707a0255e34d13a 100644 GIT binary patch delta 65 zcmeC@?BV1-&CAQh00i~3#5QujW>U}64=qkDD%LMa%}OjT&&jQev{{xppAi7>c^2gW diff --git a/task_manager/migrations/__pycache__/__init__.cpython-312.pyc b/task_manager/migrations/__pycache__/__init__.cpython-312.pyc index 1c75195fc81857b97a0812909c708b84bf0b3b98..350092dcc812eef7d5c6be0bda322d3500239b88 100644 GIT binary patch delta 62 zcmX@bc$|^@G%qg~0}#~D5}U|vte&PHTAW%`tY4Cvl~`P!nU`5ylv$QoT#{IpsPB?m QoL!P%pdTFWIx!;&0A0-$9RL6T delta 65 zcmX@kc#4txG%qg~0}%LJ;F`#7td*%BTAW%`tY4X*o>-Kam6(&5U7V4dsave?lAm0f To0?ZrtnZ##;!&D3F*OMQl%p01 From e00c6edc7b061eb306bdffd34ba867e578c44654 Mon Sep 17 00:00:00 2001 From: Yogarajalakshmi S Date: Fri, 8 Nov 2024 15:42:28 -0500 Subject: [PATCH 2/3] task creation and display page --- {task_manager => synergy_pro}/__init__.py | 0 synergy_pro/synergy_pro/urls.py | 1 + {task_manager => synergy_pro/tasks}/forms.py | 0 .../tasks}/migrations/0001_initial.py | 0 synergy_pro/tasks/models.py | 5 +++ synergy_pro/tasks/urls.py | 10 ++++++ synergy_pro/tasks/views.py | 34 +++++++++++++++++++ synergy_pro/templates/synergy_pro/base.html | 8 +++-- .../templates/tasks}/calendar.html | 0 .../templates/tasks}/create_task.html | 0 .../templates/tasks}/task_detail.html | 0 .../templates/tasks}/task_list.html | 0 .../templates/users/registration/signup.html | 2 +- synergy_pro/users/views.py | 3 +- task_manager/admin.py | 3 -- task_manager/apps.py | 6 ---- task_manager/migrations/__init__.py | 0 task_manager/models.py | 8 ----- task_manager/tests.py | 3 -- task_manager/urls.py | 10 ------ task_manager/views.py | 34 ------------------- 21 files changed, 59 insertions(+), 68 deletions(-) rename {task_manager => synergy_pro}/__init__.py (100%) rename {task_manager => synergy_pro/tasks}/forms.py (100%) rename {task_manager => synergy_pro/tasks}/migrations/0001_initial.py (100%) create mode 100644 synergy_pro/tasks/urls.py rename {task_manager/templates/task_manager => synergy_pro/templates/tasks}/calendar.html (100%) rename {task_manager/templates/task_manager => synergy_pro/templates/tasks}/create_task.html (100%) rename {task_manager/templates/task_manager => synergy_pro/templates/tasks}/task_detail.html (100%) rename {task_manager/templates/task_manager => synergy_pro/templates/tasks}/task_list.html (100%) delete mode 100644 task_manager/admin.py delete mode 100644 task_manager/apps.py delete mode 100644 task_manager/migrations/__init__.py delete mode 100644 task_manager/models.py delete mode 100644 task_manager/tests.py delete mode 100644 task_manager/urls.py delete mode 100644 task_manager/views.py diff --git a/task_manager/__init__.py b/synergy_pro/__init__.py similarity index 100% rename from task_manager/__init__.py rename to synergy_pro/__init__.py diff --git a/synergy_pro/synergy_pro/urls.py b/synergy_pro/synergy_pro/urls.py index e2f39b9..e0d636d 100644 --- a/synergy_pro/synergy_pro/urls.py +++ b/synergy_pro/synergy_pro/urls.py @@ -24,5 +24,6 @@ def home(request): urlpatterns = [ path('admin/', admin.site.urls), path('users/', include('users.urls')), + path('tasks/', include('tasks.urls')), path('', home, name='home'), # Root URL pattern ] diff --git a/task_manager/forms.py b/synergy_pro/tasks/forms.py similarity index 100% rename from task_manager/forms.py rename to synergy_pro/tasks/forms.py diff --git a/task_manager/migrations/0001_initial.py b/synergy_pro/tasks/migrations/0001_initial.py similarity index 100% rename from task_manager/migrations/0001_initial.py rename to synergy_pro/tasks/migrations/0001_initial.py diff --git a/synergy_pro/tasks/models.py b/synergy_pro/tasks/models.py index 71a8362..3b0be91 100644 --- a/synergy_pro/tasks/models.py +++ b/synergy_pro/tasks/models.py @@ -1,3 +1,8 @@ from django.db import models # Create your models here. +class Task(models.Model): + title = models.CharField(max_length=255) + description = models.TextField() + due_date = models.DateField() + created_at = models.DateTimeField(auto_now=True) diff --git a/synergy_pro/tasks/urls.py b/synergy_pro/tasks/urls.py new file mode 100644 index 0000000..ad3b16a --- /dev/null +++ b/synergy_pro/tasks/urls.py @@ -0,0 +1,10 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.task_calendar, name='task_calendar'), + path('create//', views.create_task, name='create_task'), + path('tasks/', views.task_list, name='task_list'), + path('/', views.task_detail, name='task_detail'), +] + diff --git a/synergy_pro/tasks/views.py b/synergy_pro/tasks/views.py index 91ea44a..db9e237 100644 --- a/synergy_pro/tasks/views.py +++ b/synergy_pro/tasks/views.py @@ -1,3 +1,37 @@ from django.shortcuts import render # Create your views here. +from django.shortcuts import render, redirect, get_object_or_404 +from .models import Task +from .forms import TaskForm + +# Create your views here. +# Calendar view +def task_calendar(request): + tasks = Task.objects.all() + return render(request, '../templates/tasks/calendar.html', {'tasks': tasks}) + +# View to create a task +def create_task(request, date): + if request.method == "POST": + form = TaskForm(request.POST) + if form.is_valid(): + task = form.save(commit=False) + task.due_date = date # Set the selected date + task.save() + return redirect('task_list') + else: + form = TaskForm() + + return render(request, "../templates/tasks/create_task.html", {'form': form, 'date': date}) + +# view all tasks +def task_list(request): + tasks = Task.objects.all() + return render(request, '../templates/tasks/task_list.html', {'tasks': tasks}) + +# view individual task +def task_detail(request, task_id): + task = get_object_or_404(Task, id=task_id) + return render(request, '../templates/tasks/task_detail.html', {'task': task}) + diff --git a/synergy_pro/templates/synergy_pro/base.html b/synergy_pro/templates/synergy_pro/base.html index 93c6b79..a41295f 100644 --- a/synergy_pro/templates/synergy_pro/base.html +++ b/synergy_pro/templates/synergy_pro/base.html @@ -14,7 +14,9 @@