diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/db.sqlite3" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/db.sqlite3" new file mode 100644 index 000000000..257dceb56 Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/db.sqlite3" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__init__.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__init__.py" new file mode 100644 index 000000000..e69de29bb diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/__init__.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/__init__.cpython-313.pyc" new file mode 100644 index 000000000..940ce270f Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/__init__.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/settings.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/settings.cpython-313.pyc" new file mode 100644 index 000000000..ec4a06ce6 Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/settings.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/urls.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/urls.cpython-313.pyc" new file mode 100644 index 000000000..fdc29d6a5 Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/urls.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/wsgi.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/wsgi.cpython-313.pyc" new file mode 100644 index 000000000..c4e24dc86 Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/__pycache__/wsgi.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/settings.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/settings.py" new file mode 100644 index 000000000..ef12a7c41 --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/settings.py" @@ -0,0 +1,48 @@ +import os +from pathlib import Path + +BASE_DIR = Path(__file__).resolve().parent.parent + +SECRET_KEY = 'django-insecure-test-key' + +DEBUG = True + +ALLOWED_HOSTS = [] + +INSTALLED_APPS = [ + 'django.contrib.staticfiles', + 'mainapp', +] + +MIDDLEWARE = [ + 'django.middleware.common.CommonMiddleware', +] + +ROOT_URLCONF = 'django_simple_project.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [BASE_DIR / 'mainapp' / 'templates'], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.request', + ], + }, + }, +] + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + +WSGI_APPLICATION = 'django_simple_project.wsgi.application' + +# Static files (CSS, JavaScript, Images) +STATIC_URL = '/static/' + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/urls.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/urls.py" new file mode 100644 index 000000000..d60222cc9 --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/urls.py" @@ -0,0 +1,5 @@ +from django.urls import path, include + +urlpatterns = [ + path('', include('mainapp.urls')), +] diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/wsgi.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/wsgi.py" new file mode 100644 index 000000000..b8fabd9d9 --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/django_simple_project/wsgi.py" @@ -0,0 +1,6 @@ +import os +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_simple_project.settings') + +application = get_wsgi_application() diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__init__.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__init__.py" new file mode 100644 index 000000000..e69de29bb diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/__init__.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/__init__.cpython-313.pyc" new file mode 100644 index 000000000..e2b57a589 Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/__init__.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/apps.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/apps.cpython-313.pyc" new file mode 100644 index 000000000..59f887742 Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/apps.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/forms.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/forms.cpython-313.pyc" new file mode 100644 index 000000000..9f3dc779a Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/forms.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/models.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/models.cpython-313.pyc" new file mode 100644 index 000000000..50d616b0c Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/models.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/urls.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/urls.cpython-313.pyc" new file mode 100644 index 000000000..5746829f8 Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/urls.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/views.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/views.cpython-313.pyc" new file mode 100644 index 000000000..2cdd5d4a8 Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/__pycache__/views.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/admin.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/admin.py" new file mode 100644 index 000000000..e69de29bb diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/apps.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/apps.py" new file mode 100644 index 000000000..a60fbdacc --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/apps.py" @@ -0,0 +1,5 @@ +from django.apps import AppConfig + +class MainappConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'mainapp' diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/forms.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/forms.py" new file mode 100644 index 000000000..cd2c0e84b --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/forms.py" @@ -0,0 +1,6 @@ +from django import forms + +class ContactForm(forms.Form): + name = forms.CharField(label='Имя', max_length=100) + email = forms.EmailField(label='Email') + message = forms.CharField(label='Сообщение', widget=forms.Textarea) diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/migrations/0001_initial.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/migrations/0001_initial.py" new file mode 100644 index 000000000..38d590464 --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/migrations/0001_initial.py" @@ -0,0 +1,24 @@ +# Generated by Django 5.2.1 on 2025-05-18 18:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='ContactMessage', + 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()), + ('created_at', models.DateTimeField(auto_now_add=True)), + ], + ), + ] diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/migrations/__init__.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/migrations/__init__.py" new file mode 100644 index 000000000..e69de29bb diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/migrations/__pycache__/0001_initial.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/migrations/__pycache__/0001_initial.cpython-313.pyc" new file mode 100644 index 000000000..078eb37b0 Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/migrations/__pycache__/0001_initial.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/migrations/__pycache__/__init__.cpython-313.pyc" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/migrations/__pycache__/__init__.cpython-313.pyc" new file mode 100644 index 000000000..0dd50c4d9 Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/migrations/__pycache__/__init__.cpython-313.pyc" differ diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/models.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/models.py" new file mode 100644 index 000000000..b06d71f47 --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/models.py" @@ -0,0 +1,10 @@ +from django.db import models + +class ContactMessage(models.Model): + name = models.CharField(max_length=100) + email = models.EmailField() + message = models.TextField() + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"{self.name} ({self.email})" diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/about.html" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/about.html" new file mode 100644 index 000000000..5767182b1 --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/about.html" @@ -0,0 +1,6 @@ +{% extends 'mainapp/base.html' %} +{% block title %}О разработке{% endblock %} +{% block content %} +

О разработке

+

Этот проект создан для демонстрации базовых возможностей Django: шаблоны, формы и маршрутизация.

+{% endblock %} diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/base.html" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/base.html" new file mode 100644 index 000000000..5e03b99e2 --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/base.html" @@ -0,0 +1,34 @@ + + + + + {% block title %}Django проект{% endblock %} + + + +
+ +
+
+ {% block content %} + {% endblock %} +
+ + + diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/contact.html" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/contact.html" new file mode 100644 index 000000000..47ce85975 --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/contact.html" @@ -0,0 +1,16 @@ +{% extends 'mainapp/base.html' %} +{% block title %}Обратная связь{% endblock %} +{% block content %} +

Обратная связь

+ +{% if sent %} +

Спасибо за ваше сообщение!

+{% else %} +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endif %} + +{% endblock %} diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/home.html" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/home.html" new file mode 100644 index 000000000..3f4acc599 --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/home.html" @@ -0,0 +1,18 @@ +{% extends 'mainapp/base.html' %} +{% block title %}Главная{% endblock %} +{% block content %} +

Добро пожаловать на главную страницу

+

Это простой проект на Django с тремя страницами и формой обратной связи.

+

Последние сообщения

+ +{% endblock %} diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/messages.html" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/messages.html" new file mode 100644 index 000000000..e1f23ec58 --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/templates/mainapp/messages.html" @@ -0,0 +1,17 @@ +{% extends 'mainapp/base.html' %} +{% block title %}Сообщения{% endblock %} +{% block content %} +

Полученные сообщения

+{% if messages %} + +{% else %} +

Сообщений пока нет.

+{% endif %} +{% endblock %} diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/tests.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/tests.py" new file mode 100644 index 000000000..e69de29bb diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/urls.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/urls.py" new file mode 100644 index 000000000..630bf3c5b --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/urls.py" @@ -0,0 +1,11 @@ +from django.urls import path +from . import views + +app_name = 'mainapp' + +urlpatterns = [ + path('', views.home_view, name='home'), + path('about/', views.about_view, name='about'), + path('contact/', views.contact_view, name='contact'), + path('messages/', views.messages_view, name='messages'), +] diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/views.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/views.py" new file mode 100644 index 000000000..41887fb0b --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/mainapp/views.py" @@ -0,0 +1,26 @@ +from django.shortcuts import render +from .forms import ContactForm +from .models import ContactMessage + +def home_view(request): + latest_messages = ContactMessage.objects.order_by('-created_at')[:5] + return render(request, 'mainapp/home.html', {'latest_messages': latest_messages}) + + +def about_view(request): + return render(request, 'mainapp/about.html') + +def contact_view(request): + sent = False + if request.method == 'POST': + form = ContactForm(request.POST) + if form.is_valid(): + ContactMessage.objects.create(**form.cleaned_data) + sent = True + else: + form = ContactForm() + return render(request, 'mainapp/contact.html', {'form': form, 'sent': sent}) + +def messages_view(request): + messages = ContactMessage.objects.all().order_by('-created_at') + return render(request, 'mainapp/messages.html', {'messages': messages}) diff --git "a/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/manage.py" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/manage.py" new file mode 100644 index 000000000..628c81dcf --- /dev/null +++ "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/manage.py" @@ -0,0 +1,18 @@ +#!/usr/bin/env python +import os +import sys + +def main(): + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_simple_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/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/\320\223\321\203\321\201\320\265\320\262_lab78.pdf" "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/\320\223\321\203\321\201\320\265\320\262_lab78.pdf" new file mode 100644 index 000000000..201853f44 Binary files /dev/null and "b/works/K3320/\320\223\321\203\321\201\320\265\320\262_\320\257\321\200\320\276\321\201\320\273\320\260\320\262/7-8/\320\223\321\203\321\201\320\265\320\262_lab78.pdf" differ