diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/__init__.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/__init__.py" new file mode 100644 index 000000000..e69de29bb diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/admin.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/admin.py" new file mode 100644 index 000000000..8c38f3f3d --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/admin.py" @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/apps.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/apps.py" new file mode 100644 index 000000000..167f04426 --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/apps.py" @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class MainConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'main' diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/forms.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/forms.py" new file mode 100644 index 000000000..e6c105dad --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/forms.py" @@ -0,0 +1,7 @@ +from django import forms +from .models import Feedback + +class FeedbackForm(forms.ModelForm): + class Meta: + model = Feedback + fields = ['name', 'email', 'message'] \ No newline at end of file diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/migrations/0001_initial.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/migrations/0001_initial.py" new file mode 100644 index 000000000..c9298ad81 --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/migrations/0001_initial.py" @@ -0,0 +1,23 @@ +# Generated by Django 5.2.1 on 2025-05-11 17:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Feedback', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ('email', models.EmailField(max_length=254)), + ('message', models.TextField()), + ], + ), + ] diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/migrations/__init__.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/migrations/__init__.py" new file mode 100644 index 000000000..e69de29bb diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/models.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/models.py" new file mode 100644 index 000000000..3d4bcfaaf --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/models.py" @@ -0,0 +1,9 @@ +from django.db import models + +class Feedback(models.Model): + name = models.CharField(max_length=100) + email = models.EmailField() + message = models.TextField() + + def __str__(self): + return f"{self.name}: {self.message[:30]}" \ No newline at end of file diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/static/main/style.css" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/static/main/style.css" new file mode 100644 index 000000000..e2251f82b --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/static/main/style.css" @@ -0,0 +1,86 @@ +body { + font-family: 'Roboto', sans-serif; + margin: 0; + padding: 0; + background-color: #f8f9fa; + color: #333; +} + +header { + background-color: #e0e0e0; /* светло-серый */ + padding: 20px; + text-align: center; + box-shadow: 0 2px 4px rgba(0,0,0,0.1); +} + +header h1 { + margin: 0; + font-size: 2em; +} + +nav a { + text-decoration: none; + color: #333; + margin: 0 10px; + font-weight: bold; +} + +nav a:hover { + color: #007bff; +} + +/* Main content */ +main { + padding: 30px; + max-width: 800px; + margin: auto; + background-color: #fff; + box-shadow: 0 0 10px rgba(0,0,0,0.05); + border-radius: 8px; +} + +/* Footer */ +footer { + text-align: center; + padding: 15px; + color: #666; + font-size: 0.9em; +} + +/* Form */ +form { + display: flex; + flex-direction: column; +} + +form input, +form textarea, +form button { + margin-bottom: 15px; + padding: 10px; + font-size: 1em; + border: 1px solid #ccc; + border-radius: 4px; +} + +form button { + background-color: #007bff; + color: white; + border: none; + cursor: pointer; +} + +form button:hover { + background-color: #0056b3; +} + +/* Feedback list */ +ul { + list-style: none; + padding: 0; +} + +li { + padding: 10px 0; + border-bottom: 1px solid #ddd; +} \ No newline at end of file diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/about.html" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/about.html" new file mode 100644 index 000000000..1f92afeb0 --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/about.html" @@ -0,0 +1,6 @@ +{% extends "main/base.html" %} +{% block title %}О разработке{% endblock %} +{% block content %} +

О проекте

+

Проет разработан в рамках курса по Web программированию

+{% endblock %} \ No newline at end of file diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/base.html" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/base.html" new file mode 100644 index 000000000..3957e30e2 --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/base.html" @@ -0,0 +1,28 @@ +{% load static %} + + + + {% block title %}Мой сайт{% endblock %} + + + + +
+

Мой Django сайт

+ +
+ +
+ {% block content %}{% endblock %} +
+ + + + \ No newline at end of file diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/contact.html" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/contact.html" new file mode 100644 index 000000000..86f1443c1 --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/contact.html" @@ -0,0 +1,10 @@ +{% extends "main/base.html" %} +{% block title %}Обратная связь{% endblock %} +{% block content %} +

Форма обратной связи

+
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} \ No newline at end of file diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/home.html" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/home.html" new file mode 100644 index 000000000..6deeee8cc --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/templates/main/home.html" @@ -0,0 +1,12 @@ +{% extends "main/base.html" %} +{% block title %}Главная{% endblock %} +{% block content %} +

Отзывы

+ +{% endblock %} \ No newline at end of file diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/tests.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/tests.py" new file mode 100644 index 000000000..7ce503c2d --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/tests.py" @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/urls.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/urls.py" new file mode 100644 index 000000000..04b1f8a59 --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/urls.py" @@ -0,0 +1,8 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.home, name='home'), + path('about/', views.about, name='about'), + path('contact/', views.contact, name='contact'), +] \ No newline at end of file diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/views.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/views.py" new file mode 100644 index 000000000..c11494dac --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/main/views.py" @@ -0,0 +1,20 @@ +from django.shortcuts import render, redirect +from .forms import FeedbackForm +from .models import Feedback + +def home(request): + feedbacks = Feedback.objects.all().order_by('-id') + return render(request, 'main/home.html', {'feedbacks': feedbacks}) + +def about(request): + return render(request, 'main/about.html') + +def contact(request): + if request.method == 'POST': + form = FeedbackForm(request.POST) + if form.is_valid(): + form.save() + return redirect('/') + else: + form = FeedbackForm() + return render(request, 'main/contact.html', {'form': form}) \ No newline at end of file diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/manage.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/manage.py" new file mode 100755 index 000000000..2c49f3ac2 --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/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', 'project.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/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/__init__.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/__init__.py" new file mode 100644 index 000000000..e69de29bb diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/asgi.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/asgi.py" new file mode 100644 index 000000000..3d66fe381 --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/asgi.py" @@ -0,0 +1,16 @@ +""" +ASGI config for project 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.2/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') + +application = get_asgi_application() diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/settings.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/settings.py" new file mode 100644 index 000000000..e835e44f1 --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/settings.py" @@ -0,0 +1,123 @@ +""" +Django settings for project project. + +Generated by 'django-admin startproject' using Django 5.2.1. + +For more information on this file, see +https://docs.djangoproject.com/en/5.2/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/5.2/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.2/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-9=th=0@2oyqw0f*r9#tc9ox^lc18+8f&x(e@kw-cz$0ba^ahty' + +# 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 = 'project.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 = 'project.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/5.2/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/5.2/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.2/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.2/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/urls.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/urls.py" new file mode 100644 index 000000000..1142b67fe --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/urls.py" @@ -0,0 +1,7 @@ +from django.contrib import admin +from django.urls import path, include # обязательно include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', include('main.urls')), # ← ЭТО добавляет маршруты из приложения main +] \ No newline at end of file diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/wsgi.py" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/wsgi.py" new file mode 100644 index 000000000..e896f59a5 --- /dev/null +++ "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/project/project/wsgi.py" @@ -0,0 +1,16 @@ +""" +WSGI config for project 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.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') + +application = get_wsgi_application() diff --git "a/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/web7-8.pdf" "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/web7-8.pdf" new file mode 100644 index 000000000..3c065b77f Binary files /dev/null and "b/work/K3320/\320\241\320\272\320\262\320\276\321\200\321\206\320\276\320\262_\320\230\320\262\320\260\320\275/lab7-8/web7-8.pdf" differ