From 2f46fc4be00d55d696c2ef42af06b1c1939ecf2f Mon Sep 17 00:00:00 2001 From: Wajn Date: Wed, 1 Apr 2026 03:50:10 +0300 Subject: [PATCH] completed --- CarRental/CarRental/__init__.py | 0 CarRental/CarRental/asgi.py | 16 +++ CarRental/CarRental/settings.py | 118 ++++++++++++++++++++ CarRental/CarRental/urls.py | 7 ++ CarRental/CarRental/wsgi.py | 16 +++ CarRental/main/__init__.py | 0 CarRental/main/admin.py | 3 + CarRental/main/apps.py | 5 + CarRental/main/migrations/__init__.py | 0 CarRental/main/models.py | 3 + CarRental/main/templates/main/about.html | 48 ++++++++ CarRental/main/templates/main/home.html | 47 ++++++++ CarRental/main/templates/main/password.html | 48 ++++++++ CarRental/main/tests.py | 3 + CarRental/main/urls.py | 8 ++ CarRental/main/views.py | 17 +++ CarRental/manage.py | 22 ++++ 17 files changed, 361 insertions(+) create mode 100644 CarRental/CarRental/__init__.py create mode 100644 CarRental/CarRental/asgi.py create mode 100644 CarRental/CarRental/settings.py create mode 100644 CarRental/CarRental/urls.py create mode 100644 CarRental/CarRental/wsgi.py create mode 100644 CarRental/main/__init__.py create mode 100644 CarRental/main/admin.py create mode 100644 CarRental/main/apps.py create mode 100644 CarRental/main/migrations/__init__.py create mode 100644 CarRental/main/models.py create mode 100644 CarRental/main/templates/main/about.html create mode 100644 CarRental/main/templates/main/home.html create mode 100644 CarRental/main/templates/main/password.html create mode 100644 CarRental/main/tests.py create mode 100644 CarRental/main/urls.py create mode 100644 CarRental/main/views.py create mode 100644 CarRental/manage.py diff --git a/CarRental/CarRental/__init__.py b/CarRental/CarRental/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/CarRental/CarRental/asgi.py b/CarRental/CarRental/asgi.py new file mode 100644 index 0000000..9061150 --- /dev/null +++ b/CarRental/CarRental/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for CarRental 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/6.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'CarRental.settings') + +application = get_asgi_application() diff --git a/CarRental/CarRental/settings.py b/CarRental/CarRental/settings.py new file mode 100644 index 0000000..1dcefa8 --- /dev/null +++ b/CarRental/CarRental/settings.py @@ -0,0 +1,118 @@ +""" +Django settings for CarRental project. + +Generated by 'django-admin startproject' using Django 6.0.3. + +For more information on this file, see +https://docs.djangoproject.com/en/6.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/6.0/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/6.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-6jzo!jq6_ypy)r3b#4a(8d31d@du5bwf-j2d#vuuyytzr7qh^%' + +# 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', + 'main', +] + +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 = 'CarRental.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'CarRental.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/6.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/6.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/6.0/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/6.0/howto/static-files/ + +STATIC_URL = 'static/' diff --git a/CarRental/CarRental/urls.py b/CarRental/CarRental/urls.py new file mode 100644 index 0000000..83e71c3 --- /dev/null +++ b/CarRental/CarRental/urls.py @@ -0,0 +1,7 @@ +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', include('main.urls')), +] \ No newline at end of file diff --git a/CarRental/CarRental/wsgi.py b/CarRental/CarRental/wsgi.py new file mode 100644 index 0000000..53bcd17 --- /dev/null +++ b/CarRental/CarRental/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for CarRental 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/6.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'CarRental.settings') + +application = get_wsgi_application() diff --git a/CarRental/main/__init__.py b/CarRental/main/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/CarRental/main/admin.py b/CarRental/main/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/CarRental/main/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/CarRental/main/apps.py b/CarRental/main/apps.py new file mode 100644 index 0000000..833bff6 --- /dev/null +++ b/CarRental/main/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class MainConfig(AppConfig): + name = 'main' diff --git a/CarRental/main/migrations/__init__.py b/CarRental/main/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/CarRental/main/models.py b/CarRental/main/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/CarRental/main/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/CarRental/main/templates/main/about.html b/CarRental/main/templates/main/about.html new file mode 100644 index 0000000..1fd1317 --- /dev/null +++ b/CarRental/main/templates/main/about.html @@ -0,0 +1,48 @@ + + + + About + + + + + + +

About Car Rentals

+

We provide reliable and affordable car rental services, offering a wide range of vehicles to meet your needs and make your journey comfortable and convenient.

+ + Back Home + + + \ No newline at end of file diff --git a/CarRental/main/templates/main/home.html b/CarRental/main/templates/main/home.html new file mode 100644 index 0000000..bbd9e9d --- /dev/null +++ b/CarRental/main/templates/main/home.html @@ -0,0 +1,47 @@ + + + + Home + + + + + + +

Cars Rentals

+

Hello World, This is my new HOME for Car Rentals Website! we're excited to welcome you here.

+ + About + Generate Password + + + \ No newline at end of file diff --git a/CarRental/main/templates/main/password.html b/CarRental/main/templates/main/password.html new file mode 100644 index 0000000..c131787 --- /dev/null +++ b/CarRental/main/templates/main/password.html @@ -0,0 +1,48 @@ + + + + Password + + + + + + +

Your Generated Password

+

{{ password }}

+ + Back Home + + + \ No newline at end of file diff --git a/CarRental/main/tests.py b/CarRental/main/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/CarRental/main/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/CarRental/main/urls.py b/CarRental/main/urls.py new file mode 100644 index 0000000..d33c81d --- /dev/null +++ b/CarRental/main/urls.py @@ -0,0 +1,8 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.home), + path('about/', views.about), + path('password/generate/', views.generate_password), +] \ No newline at end of file diff --git a/CarRental/main/views.py b/CarRental/main/views.py new file mode 100644 index 0000000..7e6475c --- /dev/null +++ b/CarRental/main/views.py @@ -0,0 +1,17 @@ +from django.shortcuts import render +import random + +def home(request): + return render(request, 'main/home.html') + +def about(request): + return render(request, 'main/about.html') + +def generate_password(request): + chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%" + + password = "" + for i in range(10): + password += random.choice(chars) + + return render(request, 'main/password.html', {'password': password}) \ No newline at end of file diff --git a/CarRental/manage.py b/CarRental/manage.py new file mode 100644 index 0000000..1aacbb2 --- /dev/null +++ b/CarRental/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', 'CarRental.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()