Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
11 changes: 0 additions & 11 deletions work/номер_группы/ФИО/номер_лабы/index.html

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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', 'veggie_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()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.contrib import admin
from .models import Vegetable # Импортируем модель

# Регистрируем модель для отображения в админке
admin.site.register(Vegetable)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class VegetablesConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'vegetables'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django import forms
from .models import Feedback

class FeedbackForm(forms.ModelForm):
class Meta:
model = Feedback
fields = ['name', 'email', 'message']
widgets = {
'name': forms.TextInput(attrs={'class': 'form-control'}),
'email': forms.EmailInput(attrs={'class': 'form-control'}),
'message': forms.Textarea(attrs={'class': 'form-control', 'rows': 5}),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 5.2.1 on 2025-05-19 00:05

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, verbose_name='Ваше имя')),
('email', models.EmailField(max_length=254, verbose_name='Email')),
('message', models.TextField(verbose_name='Сообщение')),
('created_at', models.DateTimeField(auto_now_add=True)),
],
),
migrations.CreateModel(
name='Vegetable',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, verbose_name='Название овоща')),
('description', models.TextField(verbose_name='Описание')),
('image', models.ImageField(blank=True, null=True, upload_to='vegetables/')),
],
),
]
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from django.db import models

class Vegetable(models.Model):
name = models.CharField(max_length=100, verbose_name="Название овоща")
description = models.TextField(verbose_name="Описание")
image = models.ImageField(
upload_to='vegetables/',
verbose_name="Изображение",
blank=True,
null=True
)

def __str__(self):
return self.name

class Feedback(models.Model):
name = models.CharField(max_length=100, verbose_name="Ваше имя")
email = models.EmailField(verbose_name="Email")
message = models.TextField(verbose_name="Сообщение")
created_at = models.DateTimeField(auto_now_add=True)

def __str__(self):
return f"Отзыв от {self.name}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends 'base.html' %}

{% block title %}О проекте - Мир Овощей{% endblock %}

{% block content %}
<h2>О проекте "Мир Овощей"</h2>
<p>Этот проект создан для всех любителей свежих и полезных овощей.</p>
<p>Мы рассказываем о различных видах овощей, их полезных свойствах и способах выращивания.</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Мир Овощей{% endblock %}</title>
<style>
body { font-family: Arial, sans-serif; margin: 0; padding: 0; }
header { background: #4CAF50; color: white; padding: 1rem; }
nav a { color: white; margin-right: 1rem; text-decoration: none; }
footer { background: #333; color: white; text-align: center; padding: 1rem; margin-top: 2rem; }
.container { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.vegetable-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.vegetable-card { border: 1px solid #ddd; padding: 1rem; border-radius: 5px; }
</style>
</head>
<body>
{% include 'includes/header.html' %}

<div class="container">
{% block content %}
{% endblock %}
</div>

{% include 'includes/footer.html' %}
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends 'base.html' %}

{% block title %}Обратная связь - Мир Овощей{% endblock %}

{% block content %}
<h2>Обратная связь</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Отправить</button>
</form>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends 'base.html' %}

{% block title %}Спасибо! - Мир Овощей{% endblock %}

{% block content %}
<h2>Спасибо за ваше сообщение!</h2>
<p>Мы свяжемся с вами в ближайшее время.</p>
<p><a href="{% url 'home' %}">Вернуться на главную</a></p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<footer>
<p>&copy; 2025 Мир Овощей Надери Мариам.</p>
<p>Все права защищены.</p>
</footer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<header>
<nav>
<a href="{% url 'home' %}">Главная</a>
<a href="{% url 'about' %}">О проекте</a>
<a href="{% url 'contact' %}">Обратная связь</a>
</nav>
<h1>Мир Овощей</h1>
</header>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends 'base.html' %}

{% block title %}Главная - Мир Овощей{% endblock %}

{% block content %}
<h2>Наши овощи</h2>
<div class="vegetable-grid">
{% for vegetable in vegetables %}
<div class="vegetable-card">
<h3>{{ vegetable.name }}</h3>
<p>{{ vegetable.description }}</p>
{% if vegetable.image %}
<img src="{{ vegetable.image.url }}" alt="{{ vegetable.name }}" width="200">
{% endif %}
</div>
{% endfor %}
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from django.shortcuts import render, redirect
from .forms import FeedbackForm
from .models import Vegetable

def home(request):
vegetables = Vegetable.objects.all()
return render(request, 'index.html', {'vegetables': vegetables})

def about(request):
return render(request, 'about.html')

def contact(request):
if request.method == 'POST':
form = FeedbackForm(request.POST)
if form.is_valid():
form.save()
return redirect('contact_success')
else:
form = FeedbackForm()
return render(request, 'contact.html', {'form': form})

def contact_success(request):
return render(request, 'contact_success.html')
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for veggie_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', 'veggie_project.settings')

application = get_asgi_application()
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
"""
Django settings for veggie_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
import os

# 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-b1+0pto+@c^)$7izj4+3a$f5c%9hd$mwyux+2$078!82z)4u^^'

# 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',
'vegetables.apps.VegetablesConfig',
]

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 = 'veggie_project.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'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 = 'veggie_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 = 'ru-ru'

TIME_ZONE = 'Europe/Moscow'

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'

DEBUG = True # Должно быть True для разработки

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
Loading