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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Binary file added work/.DS_Store
Binary file not shown.
Binary file added work/K3322/.DS_Store
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,6 @@
from django.contrib import admin
from .models import Product
from .models import ContactMessage

admin.site.register(Product)
admin.site.register(ContactMessage)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django import forms
from .models import ContactMessage

class ContactForm(forms.ModelForm):
class Meta:
model = ContactMessage
fields = ['name', 'email', 'message']
labels = {
'name': 'Ваше имя',
'email': 'Электронная почта',
'message': 'Сообщение',
}
widgets = {
'name': forms.TextInput(attrs={'placeholder': 'Введите ваше имя'}),
'email': forms.EmailInput(attrs={'placeholder': 'Введите email'}),
'message': forms.Textarea(attrs={'placeholder': 'Ваше сообщение'}),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 5.2.1 on 2025-05-19 10:29

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()),
],
),
migrations.CreateModel(
name='Product',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('price', models.PositiveIntegerField()),
('size', models.CharField(choices=[('XXS', 'Double Extra Small'), ('XS', 'Extra Small'), ('S', 'Small'), ('M', 'Medium'), ('L', 'Large'), ('XL', 'Extra Large'), ('XXL', 'Double Extra Large')], default='M', max_length=3)),
('color', models.CharField(choices=[('red', 'Red'), ('white', 'White'), ('black', 'Black'), ('grey', 'Grey')], default='white', max_length=10)),
('image', models.ImageField(upload_to='cars/')),
('category', models.CharField(choices=[('t', 'T-shirt'), ('h', 'Hoodies')], default='t', max_length=10)),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.2.1 on 2025-05-19 10:57

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dealership', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='product',
name='category',
field=models.CharField(choices=[('t', 'T-shirt'), ('h', 'Hoodies')], default='t-s', max_length=10),
),
]
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,40 @@
from django.db import models

class ContactMessage(models.Model):
name = models.CharField(max_length=100)
email = models.EmailField()
message = models.TextField()

def __str__(self):
return f"Message from {self.name}"


class Product(models.Model):
SIZES = [
('XXS', 'Double Extra Small'),
('XS', 'Extra Small'),
('S', 'Small'),
('M', 'Medium'),
('L', 'Large'),
('XL', 'Extra Large'),
('XXL', 'Double Extra Large'),
]

COLORS = [
('red', 'Red'),
('white', 'White'),
('black', 'Black'),
('grey', 'Grey'),
]


name = models.CharField(max_length=100)
price = models.PositiveIntegerField()
size = models.CharField(max_length=3, choices=SIZES, default='M')
color = models.CharField(max_length=10, choices=COLORS, default='white')
image = models.ImageField(upload_to='cars/')
category = models.CharField(max_length=10, choices=[('t', 'T-shirt'), ('h', 'Hoodies')], default='t-s')

def __str__(self):
return self.name

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends 'base.html' %}

{% block title %}О компании - Автомобили Баварии{% endblock %}

{% block content %}
<div class="about-container">
<h2>О компании</h2>
<p>
<strong>«SHOP AVANGARD»</strong> — официальный магазин хоккейной атрибутики <strong>хк "Авангард"</strong> в России. Уже более <strong>20 лет</strong> мы с гордостью представляем легендарный хоккейный клуб на отечественном рынке, сочетая уже привычные коллекции с новыми интересными решениями.
</p>
<p>
Мы располагаем широкой сетью магазинов по всей стране, от Москвы до Владивостока. В каждом из наших магазинов вас встретит профессиональная команда, готовая помочь в выборе идеального мерча и предложить индивидуальные условия покупки, учитывая вашу активность в приложении.
</p>
<p>
Все товары, приобретённые у нас, имеют официальную <strong>гарантию качества сроком 3 месяца</strong>. Мы уверены в качестве продукции SHOP AVANGARD и поддерживаем клиентов на всех этапах покупки — от регистрации до получения в магазинах на местах.
</p>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}SHOP AVANGARD{% endblock %}</title>
{% load static %}
<link rel="stylesheet" href="{% static 'style.css' %}">
</head>
<body>
<header>
<h1 class="company-name">Хоккейный клуб Авангард.</h1>
<nav>
<a href="{% url 'home' %}">Главная</a>
<a href="{% url 'about' %}">О компании</a>
<a href="{% url 'contact' %}">Обратная связь</a>
</nav>
</header>

<main>
{% block content %}{% endblock %}
</main>

<footer>
<p>&copy; 2025 HAWK AVANGARD OMSK</p>
</footer>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% extends 'base.html' %}

{% block title %}Контакты - Автомобили Баварии{% endblock %}

{% block content %}
<div class="contact-container">
<h2 class="contact-title">Свяжитесь с нами</h2>
<p class="contact-description">
Если у вас есть вопросы по моделям, сервисному обслуживанию или вы хотите записаться на тест-драйв — заполните форму ниже, и мы свяжемся с вами.
</p>

<form class="contact-form" method="post">
{% csrf_token %}
{{ form.non_field_errors }}
{% for field in form %}
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.errors %}
<div class="error">{{ field.errors|striptags }}</div>
{% endif %}
{% endfor %}
<button type="submit" class="submit-button">Отправить сообщение</button>
</form>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{% extends 'base.html' %}

{% block title %}Home - SHOP AVANGARD{% endblock %}

{% block content %}
<!-- <h2>T-shirts</h2> -->
<div class="card-container">
{% for product in t_shirts %}
<div class="product-card">
<img src="{{ product.image.url }}" alt="{{ product.model_name }}">
<h3 class="product-name">{{ product.name }} </h3>
<p>Price: {{ product.price }} руб.</p>
<p>Size: {{ product.size }}</p>
<p>Color: {{ product.color }}</p>
<p>{{ product.description }}</p>
</div>
{% endfor %}
</div>
<h2>Hoodies and T-shirts</h2>
<div class="card-container">
{% for product in hoodies %}
<div class="product-card">
<img src="{{ product.image.url }}" alt="{{ product.model_name }}">
<h3 class="product-name">{{ product.name }} </h3>
<p>Price: ${{ product.price }}</p>
<p>Size: {{ product.size }}</p>
<p>Color: {{ product.color }}</p>
<p>{{ product.description }}</p>
{% endfor %}
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% extends 'base.html' %}

{% block title %}Спасибо за обращение - Автомобили Баварии{% endblock %}

{% block content %}
<div class="thanks-container">
<h1>Спасибо за обращение!</h1>
<p>Мы скоро с вами свяжемся.</p>
<a href="{% url 'home' %}" class="home-link">Вернуться на главную</a>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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'),
path('thanks/', views.thanks, name='thanks'),
]

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from django.shortcuts import render, redirect
from .models import ContactMessage
from django.core.mail import send_mail
from django.conf import settings
from django.http import HttpResponse
from .models import Product
from .forms import ContactForm

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

def contact(request):
if request.method == 'POST':
form = ContactForm(request.POST)
if form.is_valid():
form.save() # Сохраняем данные в базу
return redirect('thanks') # Или другая страница после отправки
else:
form = ContactForm()
return render(request, 'contact.html', {'form': form})

def home(request):
t_shirts = Product.objects.filter(category='t')
hoodies = Product.objects.filter(category='h')
return render(request, 'home.html', {
't-shirts': t_shirts,
'hoodies': hoodies,
})

def thanks(request):
return render(request, 'thanks.html')
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', 'mysite.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()
Binary file not shown.
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.
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.
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.
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.
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for mysite 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', 'mysite.settings')

application = get_asgi_application()
Loading