Merge branch 'develop' into develop_test
# Conflicts: # OneCprogsite/OneCprogsite/__pycache__/settings.cpython-310.pyc
BIN
OneCprogsite/OneCprogsite/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
OneCprogsite/OneCprogsite/__pycache__/settings.cpython-311.pyc
Normal file
BIN
OneCprogsite/OneCprogsite/__pycache__/urls.cpython-311.pyc
Normal file
BIN
OneCprogsite/OneCprogsite/__pycache__/wsgi.cpython-311.pyc
Normal file
0
OneCprogsite/__init__.py
Normal file
BIN
OneCprogsite/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
OneCprogsite/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
OneCprogsite/__pycache__/settings.cpython-310.pyc
Normal file
BIN
OneCprogsite/__pycache__/settings.cpython-311.pyc
Normal file
BIN
OneCprogsite/__pycache__/urls.cpython-310.pyc
Normal file
BIN
OneCprogsite/__pycache__/urls.cpython-311.pyc
Normal file
BIN
OneCprogsite/__pycache__/wsgi.cpython-310.pyc
Normal file
BIN
OneCprogsite/__pycache__/wsgi.cpython-311.pyc
Normal file
16
OneCprogsite/asgi.py
Normal file
@ -0,0 +1,16 @@
|
||||
"""
|
||||
ASGI config for OneCprogsite 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/4.2/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'OneCprogsite.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
212
OneCprogsite/settings.py
Normal file
@ -0,0 +1,212 @@
|
||||
"""
|
||||
Django settings for OneCprogsite project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 4.2.7.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.2/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||
"""
|
||||
import os.path
|
||||
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/4.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-5rs2a1*8cxjkv*%6k1-88biv&1#nep%@i+%1^dk=5j$s&e&hwm'
|
||||
|
||||
# Безопасность cookies для HTTPS
|
||||
SESSION_COOKIE_SECURE = True
|
||||
CSRF_COOKIE_SECURE = True
|
||||
SESSION_COOKIE_HTTPONLY = True
|
||||
CSRF_COOKIE_HTTPONLY = False # Django требует доступ к CSRF cookie через JS
|
||||
SESSION_COOKIE_SAMESITE = 'Lax'
|
||||
CSRF_COOKIE_SAMESITE = 'Lax'
|
||||
|
||||
# Если используете другие cookies
|
||||
LANGUAGE_COOKIE_SECURE = True
|
||||
LANGUAGE_COOKIE_HTTPONLY = True
|
||||
LANGUAGE_COOKIE_SAMESITE = 'Lax'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
|
||||
X_FRAME_OPTIONS = 'SAMEORIGIN'
|
||||
# Или разрешить конкретные домены (Django 4.0+)
|
||||
X_FRAME_OPTIONS = 'ALLOW-FROM https://metrika.yandex.ru'
|
||||
|
||||
# ОБЯЗАТЕЛЬНО укажите ваши домены
|
||||
ALLOWED_HOSTS = [
|
||||
'nikdizell.ru',
|
||||
'www.nikdizell.ru',
|
||||
'localhost',
|
||||
'127.0.0.1',
|
||||
'192.168.31.88' # Добавьте IP сервера
|
||||
]
|
||||
|
||||
# Важно для работы за прокси
|
||||
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||
SECURE_SSL_REDIRECT = True
|
||||
|
||||
# Дополнительная безопасность
|
||||
SECURE_BROWSER_XSS_FILTER = True
|
||||
SECURE_CONTENT_TYPE_NOSNIFF = True
|
||||
SECURE_HSTS_SECONDS = 31536000
|
||||
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
|
||||
SECURE_HSTS_PRELOAD = True
|
||||
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
'https://nikdizell.ru',
|
||||
'https://www.nikdizell.ru',
|
||||
]
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'programmer.apps.ProgrammerConfig',
|
||||
'django_bootstrap5',
|
||||
'django_extensions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.sitemaps',
|
||||
]
|
||||
|
||||
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',
|
||||
'programmer.middleware.PageViewMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'OneCprogsite.urls'
|
||||
|
||||
# Кастомный middleware для CSP
|
||||
class CSPMiddleware:
|
||||
def __init__(self, get_response):
|
||||
self.get_response = get_response
|
||||
|
||||
def __call__(self, request):
|
||||
response = self.get_response(request)
|
||||
response['Content-Security-Policy'] = "frame-ancestors 'self' https://metrika.yandex.ru https://metrika.yandex.by https://metrica.yandex.com https://metrica.yandex.com.tr https://*.webvisor.com"
|
||||
return response
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'programmer.context_processors.menu_processor',
|
||||
'programmer.context_processors.contact_info',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'OneCprogsite.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'App',
|
||||
'USER': 'postgres',
|
||||
'PASSWORD': 'NikDi94Zell',
|
||||
'HOST': 'postgres',
|
||||
'PORT': 5432,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/4.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/4.2/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'ru'
|
||||
|
||||
TIME_ZONE = 'Europe/Moscow'
|
||||
USE_I18N = True
|
||||
USE_I18N = True
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
STATICFILES_DIRS = []
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
# Настройки email
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
# EMAIL_HOST = 'smtp.yandex.ru' # или smtp.gmail.com, smtp.mail.ru
|
||||
# EMAIL_PORT = 587
|
||||
# EMAIL_USE_TLS = True
|
||||
# EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER', 'it@yandex.ru')
|
||||
# EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD', 'tifdctkrcjcqwxyc')
|
||||
# DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
|
||||
# SERVER_EMAIL = EMAIL_HOST_USER
|
||||
|
||||
EMAIL_HOST = 'smtp.gmail.com' # или smtp.gmail.com, smtp.mail.ru
|
||||
EMAIL_PORT = 587
|
||||
EMAIL_USE_TLS = True
|
||||
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER', 'nikdizell@gmail.com')
|
||||
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD', 'qvmw yccb msqv mmpj')
|
||||
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
|
||||
SERVER_EMAIL = EMAIL_HOST_USER
|
||||
|
||||
# Email для уведомлений (можно указать несколько через запятую)
|
||||
# ADMIN_EMAILS = os.getenv('ADMIN_EMAILS', 'nikdizell@gmail.com').split(',')
|
||||
ADMIN_EMAILS = os.getenv('ADMIN_EMAILS', 'it@nserdyuk.ru').split(',')
|
||||
|
||||
|
||||
39
OneCprogsite/urls.py
Normal file
@ -0,0 +1,39 @@
|
||||
"""
|
||||
URL configuration for OneCprogsite project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/4.2/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.conf.urls.static import static
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
|
||||
from OneCprogsite import settings
|
||||
from programmer.views import *
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('', include('programmer.urls')),
|
||||
# path('', index, name='home'),
|
||||
# path('about/', about, name='about'),
|
||||
# path('solution/', solution, name='solution'),
|
||||
# path('ability/', ability, name='ability'),
|
||||
# path('recall/', recall, name='recall'),
|
||||
# path('post/<int:post_id>', show_post, name='post'),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
handler404 = pageNotFound
|
||||
16
OneCprogsite/wsgi.py
Normal file
@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for OneCprogsite 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/4.2/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'OneCprogsite.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
17
README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Django Site - Программист
|
||||
|
||||
Проект сайта-портфолио программиста.
|
||||
|
||||
## Функциональность
|
||||
- Компетенции и решения
|
||||
- Отзывы клиентов
|
||||
- Обратная связь
|
||||
- Аналитика посещений
|
||||
- Темная/светлая тема
|
||||
|
||||
## Установка
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
python manage.py migrate
|
||||
python manage.py collectstatic
|
||||
python manage.py createsuperuser
|
||||
22
manage.py
Normal file
@ -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', 'OneCprogsite.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()
|
||||
BIN
media/home_image/2023/11/25/9.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
media/home_image/2025/10/12/photomode_05082024_232531.png
Normal file
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 943 KiB |
|
After Width: | Height: | Size: 911 KiB |
BIN
media/photos/2023/11/24/Табличный_документ.jpg
Normal file
|
After Width: | Height: | Size: 548 KiB |
BIN
media/scan/2025/11/14/Отзыв_о_работе_РОВЕН_Сердюк_Н..jpg
Normal file
|
After Width: | Height: | Size: 850 KiB |
BIN
media_backup/home_image/2023/11/25/9.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
media_backup/home_image/2025/10/12/photomode_05082024_232531.png
Normal file
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 943 KiB |
|
After Width: | Height: | Size: 911 KiB |
BIN
media_backup/photos/2023/11/24/Табличный_документ.jpg
Normal file
|
After Width: | Height: | Size: 548 KiB |
BIN
media_backup/scan/2025/11/14/Отзыв_о_работе_РОВЕН_Сердюк_Н..jpg
Normal file
|
After Width: | Height: | Size: 850 KiB |
0
programmer/__init__.py
Normal file
BIN
programmer/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
programmer/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
programmer/__pycache__/admin.cpython-310.pyc
Normal file
BIN
programmer/__pycache__/admin.cpython-311.pyc
Normal file
BIN
programmer/__pycache__/apps.cpython-310.pyc
Normal file
BIN
programmer/__pycache__/apps.cpython-311.pyc
Normal file
BIN
programmer/__pycache__/context_processors.cpython-310.pyc
Normal file
BIN
programmer/__pycache__/context_processors.cpython-311.pyc
Normal file
BIN
programmer/__pycache__/forms.cpython-310.pyc
Normal file
BIN
programmer/__pycache__/forms.cpython-311.pyc
Normal file
BIN
programmer/__pycache__/middleware.cpython-311.pyc
Normal file
BIN
programmer/__pycache__/models.cpython-310.pyc
Normal file
BIN
programmer/__pycache__/models.cpython-311.pyc
Normal file
BIN
programmer/__pycache__/sitemaps.cpython-311.pyc
Normal file
BIN
programmer/__pycache__/urls.cpython-310.pyc
Normal file
BIN
programmer/__pycache__/urls.cpython-311.pyc
Normal file
BIN
programmer/__pycache__/views.cpython-310.pyc
Normal file
BIN
programmer/__pycache__/views.cpython-311.pyc
Normal file
169
programmer/admin.py
Normal file
@ -0,0 +1,169 @@
|
||||
from django.contrib import admin
|
||||
from django.utils import timezone
|
||||
from django.utils.html import format_html
|
||||
from django.urls import path
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.contrib import messages
|
||||
from .models import *
|
||||
|
||||
|
||||
class ProgrammerAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'title', 'time_create', 'photo', 'is_published')
|
||||
list_display_links = ('id', 'title')
|
||||
search_fields = ('title', 'content')
|
||||
list_editable = ('is_published',)
|
||||
list_filter = ('time_create', 'is_published')
|
||||
|
||||
|
||||
class RecallAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'title', 'time_create', 'scan', 'is_published')
|
||||
list_display_links = ('id', 'title')
|
||||
search_fields = ('title', 'content')
|
||||
list_editable = ('is_published',)
|
||||
list_filter = ('time_create', 'is_published')
|
||||
|
||||
|
||||
class SolutionAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'title', 'time_create', 'is_published')
|
||||
list_display_links = ('id', 'title')
|
||||
search_fields = ('title', 'description', 'implementation')
|
||||
list_editable = ('is_published',)
|
||||
list_filter = ('time_create', 'is_published')
|
||||
|
||||
|
||||
class HomeAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'title', 'time_create', 'is_published')
|
||||
list_display_links = ('id', 'title')
|
||||
search_fields = ('title', 'content')
|
||||
list_editable = ('is_published',)
|
||||
list_filter = ('time_create', 'is_published')
|
||||
|
||||
|
||||
@admin.register(CallbackRequest)
|
||||
class CallbackAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'phone', 'email', 'time_create', 'is_processed', 'is_read', 'new_badge')
|
||||
list_display_links = ('name', 'phone')
|
||||
list_editable = ('is_processed', 'is_read')
|
||||
list_filter = ('time_create', 'is_processed', 'is_read')
|
||||
search_fields = ('name', 'phone', 'email')
|
||||
readonly_fields = ('time_create',)
|
||||
actions = ['mark_as_read', 'mark_as_unread', 'mark_as_processed']
|
||||
actions = ['mark_as_read', 'mark_as_unread', 'mark_as_processed', 'resend_notification']
|
||||
|
||||
def resend_notification(self, request, queryset):
|
||||
from .utils.email_notifications import send_callback_notification
|
||||
count = 0
|
||||
for callback in queryset:
|
||||
success = send_callback_notification(callback)
|
||||
if success:
|
||||
count += 1
|
||||
self.message_user(request, f'Уведомления отправлены для {count} заявок')
|
||||
|
||||
resend_notification.short_description = "Переотправить email уведомления"
|
||||
|
||||
def new_badge(self, obj):
|
||||
if not obj.is_read:
|
||||
return format_html('<span style="color: red; font-weight: bold;">🆕 НОВАЯ</span>')
|
||||
return ""
|
||||
|
||||
new_badge.short_description = 'Статус'
|
||||
|
||||
def get_queryset(self, request):
|
||||
# Показываем количество непрочитанных в заголовке
|
||||
unread_count = CallbackRequest.objects.filter(is_read=False).count()
|
||||
if unread_count > 0:
|
||||
self.message_user(
|
||||
request,
|
||||
f'У вас {unread_count} непрочитанных заявок!',
|
||||
messages.WARNING
|
||||
)
|
||||
return super().get_queryset(request)
|
||||
|
||||
def mark_as_read(self, request, queryset):
|
||||
updated = queryset.update(is_read=True)
|
||||
self.message_user(request, f'{updated} заявок отмечены как прочитанные')
|
||||
|
||||
mark_as_read.short_description = "Отметить как прочитанные"
|
||||
|
||||
def mark_as_unread(self, request, queryset):
|
||||
updated = queryset.update(is_read=False)
|
||||
self.message_user(request, f'{updated} заявок отмечены как непрочитанные')
|
||||
|
||||
mark_as_unread.short_description = "Отметить как непрочитанные"
|
||||
|
||||
def mark_as_processed(self, request, queryset):
|
||||
updated = queryset.update(is_processed=True)
|
||||
self.message_user(request, f'{updated} заявок отмечены как обработанные')
|
||||
|
||||
mark_as_processed.short_description = "Отметить как обработанные"
|
||||
|
||||
# Добавляем кастомное представление для статистики
|
||||
def get_urls(self):
|
||||
urls = super().get_urls()
|
||||
custom_urls = [
|
||||
path('callback-stats/', self.admin_site.admin_view(self.callback_stats), name='callback_stats'),
|
||||
]
|
||||
return custom_urls + urls
|
||||
|
||||
def callback_stats(self, request):
|
||||
today = timezone.now().date()
|
||||
week_ago = today - timezone.timedelta(days=7)
|
||||
|
||||
stats = {
|
||||
'total': CallbackRequest.objects.count(),
|
||||
'today': CallbackRequest.objects.filter(time_create__date=today).count(),
|
||||
'week': CallbackRequest.objects.filter(time_create__date__gte=week_ago).count(),
|
||||
'unread': CallbackRequest.objects.filter(is_read=False).count(),
|
||||
'unprocessed': CallbackRequest.objects.filter(is_processed=False).count(),
|
||||
}
|
||||
|
||||
context = {
|
||||
**self.admin_site.each_context(request),
|
||||
'title': 'Статистика заявок',
|
||||
'stats': stats,
|
||||
}
|
||||
return render(request, 'admin/callback_stats.html', context)
|
||||
|
||||
class ProgrammerAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'title', 'time_create', 'photo', 'is_published')
|
||||
list_display_links = ('id', 'title')
|
||||
search_fields = ('title', 'content')
|
||||
list_editable = ('is_published',)
|
||||
list_filter = ('time_create', 'is_published')
|
||||
|
||||
class RecallAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'title', 'time_create', 'scan', 'is_published')
|
||||
list_display_links = ('id', 'title')
|
||||
search_fields = ('title', 'content')
|
||||
list_editable = ('is_published',)
|
||||
list_filter = ('time_create', 'is_published')
|
||||
|
||||
class SolutionAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'title', 'time_create', 'is_published')
|
||||
list_display_links = ('id', 'title')
|
||||
search_fields = ('title', 'description', 'implementation')
|
||||
list_editable = ('is_published',)
|
||||
list_filter = ('time_create', 'is_published')
|
||||
|
||||
class HomeAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'title', 'time_create', 'is_published')
|
||||
list_display_links = ('id', 'title')
|
||||
search_fields = ('title', 'content')
|
||||
list_editable = ('is_published',)
|
||||
list_filter = ('time_create', 'is_published')
|
||||
|
||||
@admin.register(PageView)
|
||||
class PageViewAdmin(admin.ModelAdmin):
|
||||
list_display = ['url', 'timestamp', 'ip_address']
|
||||
list_filter = ['timestamp', 'url']
|
||||
search_fields = ['url', 'ip_address']
|
||||
date_hierarchy = 'timestamp'
|
||||
|
||||
def get_queryset(self, request):
|
||||
return super().get_queryset(request).order_by('-timestamp')
|
||||
|
||||
admin.site.register(Competence, ProgrammerAdmin)
|
||||
admin.site.register(Recall, RecallAdmin)
|
||||
admin.site.register(Solution, SolutionAdmin)
|
||||
admin.site.register(Home, HomeAdmin)
|
||||
7
programmer/apps.py
Normal file
@ -0,0 +1,7 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ProgrammerConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'programmer'
|
||||
verbose_name = 'Программисты'
|
||||
12
programmer/context_processors.py
Normal file
@ -0,0 +1,12 @@
|
||||
from .views import menu
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
def menu_processor(request):
|
||||
return {'menu': menu}
|
||||
|
||||
def contact_info(request):
|
||||
return {
|
||||
'CONTACT_EMAIL': getattr(settings, 'CONTACT_EMAIL', 'it@nserdyuk.ru'),
|
||||
'CONTACT_PHONE': getattr(settings, 'CONTACT_PHONE', '+7 (960) 469-40-88'),
|
||||
}
|
||||
33
programmer/forms.py
Normal file
@ -0,0 +1,33 @@
|
||||
from django import forms
|
||||
from .models import CallbackRequest
|
||||
|
||||
|
||||
class CallbackForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = CallbackRequest
|
||||
fields = ['name', 'phone', 'email', 'question']
|
||||
widgets = {
|
||||
'name': forms.TextInput(attrs={
|
||||
'class': 'form-input',
|
||||
'placeholder': 'Ваше имя'
|
||||
}),
|
||||
'phone': forms.TextInput(attrs={
|
||||
'class': 'form-input',
|
||||
'placeholder': '+7 (___) ___-__-__'
|
||||
}),
|
||||
'email': forms.EmailInput(attrs={
|
||||
'class': 'form-input',
|
||||
'placeholder': 'your@email.com'
|
||||
}),
|
||||
'question': forms.Textarea(attrs={
|
||||
'class': 'form-textarea',
|
||||
'placeholder': 'Опишите ваш вопрос или задачу...',
|
||||
'rows': 4
|
||||
}),
|
||||
}
|
||||
labels = {
|
||||
'name': 'Имя',
|
||||
'phone': 'Телефон',
|
||||
'email': 'Электронная почта',
|
||||
'question': 'Ваш вопрос'
|
||||
}
|
||||
0
programmer/management/__init__.py
Normal file
BIN
programmer/management/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
programmer/management/__pycache__/__init__.cpython-311.pyc
Normal file
0
programmer/management/commands/__init__.py
Normal file
33
programmer/management/commands/send_daily_summary.py
Normal file
@ -0,0 +1,33 @@
|
||||
# programmer/management/commands/send_daily_summary.py
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import timezone
|
||||
from programmer.utils.email_notifications import send_daily_summary
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Отправляет ежедневную сводку по заявкам на email'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
'--test',
|
||||
action='store_true',
|
||||
help='Тестовая отправка (не учитывает реальные данные)',
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if options['test']:
|
||||
self.stdout.write(self.style.WARNING('Тестовая отправка ежедневной сводки...'))
|
||||
# Здесь можно добавить тестовые данные
|
||||
else:
|
||||
self.stdout.write('Отправка ежедневной сводки...')
|
||||
|
||||
success = send_daily_summary()
|
||||
|
||||
if success:
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(f'Ежедневная сводка отправлена успешно! Время: {timezone.now()}')
|
||||
)
|
||||
else:
|
||||
self.stdout.write(
|
||||
self.style.WARNING('Ежедневная сводка не отправлена (нет данных или ошибка)')
|
||||
)
|
||||
29
programmer/management/commands/test_email.py
Normal file
@ -0,0 +1,29 @@
|
||||
# programmer/management/commands/test_email.py
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.conf import settings
|
||||
from programmer.utils.email_notifications import send_test_email
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Test email configuration'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
self.stdout.write("Testing email configuration...")
|
||||
|
||||
# Проверяем настройки
|
||||
self.stdout.write(f"EMAIL_HOST: {settings.EMAIL_HOST}")
|
||||
self.stdout.write(f"EMAIL_PORT: {settings.EMAIL_PORT}")
|
||||
self.stdout.write(f"EMAIL_HOST_USER: {settings.EMAIL_HOST_USER}")
|
||||
self.stdout.write(f"ADMIN_EMAILS: {settings.ADMIN_EMAILS}")
|
||||
|
||||
# Тестируем отправку
|
||||
success = send_test_email()
|
||||
|
||||
if success:
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS('✅ Test email sent successfully!')
|
||||
)
|
||||
else:
|
||||
self.stdout.write(
|
||||
self.style.ERROR('❌ Failed to send test email. Check your email settings.')
|
||||
)
|
||||
27
programmer/management/commands/test_sitemap.py
Normal file
@ -0,0 +1,27 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.contrib.sitemaps import Sitemap
|
||||
from django.urls import reverse
|
||||
from programmer.models import Home, Solution, Competence, Recall
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Test sitemap generation'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
from programmer.sitemaps import sitemaps
|
||||
|
||||
self.stdout.write('Testing sitemap generation...')
|
||||
|
||||
for name, sitemap in sitemaps.items():
|
||||
self.stdout.write(f'\n{name}:')
|
||||
items = sitemap().items()
|
||||
self.stdout.write(f' Items found: {len(items)}')
|
||||
|
||||
for item in items[:3]: # Показываем первые 3 элемента
|
||||
try:
|
||||
url = sitemap().location(item)
|
||||
self.stdout.write(f' - {url}')
|
||||
except Exception as e:
|
||||
self.stdout.write(f' - Error: {e}')
|
||||
|
||||
self.stdout.write('\nSitemap test completed!')
|
||||
54
programmer/middleware.py
Normal file
@ -0,0 +1,54 @@
|
||||
from .models import PageView, Visitor
|
||||
from django.utils import timezone
|
||||
from django.db import transaction
|
||||
|
||||
|
||||
class PageViewMiddleware:
|
||||
def __init__(self, get_response):
|
||||
self.get_response = get_response
|
||||
|
||||
def __call__(self, request):
|
||||
# Игнорируем статические файлы и админку
|
||||
if not request.path.startswith('/static/') and not request.path.startswith('/admin/'):
|
||||
self.track_page_view(request)
|
||||
|
||||
response = self.get_response(request)
|
||||
return response
|
||||
|
||||
def track_page_view(self, request):
|
||||
try:
|
||||
with transaction.atomic():
|
||||
# Сохраняем просмотр страницы
|
||||
PageView.objects.create(
|
||||
url=request.path,
|
||||
ip_address=self.get_client_ip(request),
|
||||
user_agent=request.META.get('HTTP_USER_AGENT', ''),
|
||||
referer=request.META.get('HTTP_REFERER', '')
|
||||
)
|
||||
|
||||
# Обновляем статистику посетителя
|
||||
ip = self.get_client_ip(request)
|
||||
visitor, created = Visitor.objects.get_or_create(
|
||||
ip_address=ip,
|
||||
defaults={
|
||||
'first_visit': timezone.now(),
|
||||
'last_visit': timezone.now()
|
||||
}
|
||||
)
|
||||
|
||||
if not created:
|
||||
visitor.last_visit = timezone.now()
|
||||
visitor.visit_count += 1
|
||||
visitor.save()
|
||||
|
||||
except Exception as e:
|
||||
# Логируем ошибку, но не прерываем выполнение
|
||||
print(f"Error tracking page view: {e}")
|
||||
|
||||
def get_client_ip(self, request):
|
||||
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
|
||||
if x_forwarded_for:
|
||||
ip = x_forwarded_for.split(',')[0]
|
||||
else:
|
||||
ip = request.META.get('REMOTE_ADDR')
|
||||
return ip
|
||||
26
programmer/migrations/0001_initial.py
Normal file
@ -0,0 +1,26 @@
|
||||
# Generated by Django 4.2.7 on 2023-11-23 12:47
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Competence',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=255)),
|
||||
('content', models.TextField(blank=True)),
|
||||
('photo', models.ImageField(upload_to='photos/%Y/%m/%d/')),
|
||||
('time_create', models.DateTimeField(auto_now_add=True)),
|
||||
('time_update', models.DateTimeField(auto_now=True)),
|
||||
('is_publiched', models.BooleanField(default=True)),
|
||||
],
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,47 @@
|
||||
# Generated by Django 4.2.7 on 2023-11-24 08:03
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('programmer', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='competence',
|
||||
options={'ordering': ['time_create', 'title'], 'verbose_name': 'Компитенция', 'verbose_name_plural': 'Компитенции'},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='competence',
|
||||
name='content',
|
||||
field=models.TextField(blank=True, verbose_name='Компетенция'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='competence',
|
||||
name='is_publiched',
|
||||
field=models.BooleanField(default=True, verbose_name='Опубликован'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='competence',
|
||||
name='photo',
|
||||
field=models.ImageField(upload_to='photos/%Y/%m/%d/', verbose_name='Фото'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='competence',
|
||||
name='time_create',
|
||||
field=models.DateTimeField(auto_now_add=True, verbose_name='Дата создания'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='competence',
|
||||
name='time_update',
|
||||
field=models.DateTimeField(auto_now=True, verbose_name='Дата изменения'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='competence',
|
||||
name='title',
|
||||
field=models.CharField(max_length=255, verbose_name='Программист'),
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,35 @@
|
||||
# Generated by Django 4.2.7 on 2023-11-24 11:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('programmer', '0002_alter_competence_options_alter_competence_content_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Recall',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=255, verbose_name='Организация')),
|
||||
('content', models.TextField(blank=True, verbose_name='Отзыв')),
|
||||
('photo', models.ImageField(upload_to='photos/%Y/%m/%d/', verbose_name='Фото')),
|
||||
('time_create', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
|
||||
('time_update', models.DateTimeField(auto_now=True, verbose_name='Дата изменения')),
|
||||
('is_published', models.BooleanField(default=True, verbose_name='Опубликован')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Отзыв',
|
||||
'verbose_name_plural': 'Отзывы',
|
||||
'ordering': ['time_create', 'title'],
|
||||
},
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='competence',
|
||||
old_name='is_publiched',
|
||||
new_name='is_published',
|
||||
),
|
||||
]
|
||||
18
programmer/migrations/0004_rename_photo_recall_scan.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.7 on 2023-11-24 12:02
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('programmer', '0003_recall_rename_is_publiched_competence_is_published'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='recall',
|
||||
old_name='photo',
|
||||
new_name='scan',
|
||||
),
|
||||
]
|
||||
31
programmer/migrations/0005_auto_20231124_1519.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Generated by Django 4.2.7 on 2023-11-24 12:19
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('programmer', '0004_rename_photo_recall_scan'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Recall',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=255, verbose_name='Организация')),
|
||||
('content', models.TextField(blank=True, verbose_name='Отзыв')),
|
||||
('scan', models.ImageField(upload_to='photos/%Y/%m/%d/', verbose_name='Скан')),
|
||||
('time_create', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
|
||||
('time_update', models.DateTimeField(auto_now=True, verbose_name='Дата изменения')),
|
||||
('is_published', models.BooleanField(default=True, verbose_name='Опубликован')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Отзыв',
|
||||
'verbose_name_plural': 'Отзывы',
|
||||
'ordering': ['time_create', 'title'],
|
||||
},
|
||||
),
|
||||
]
|
||||
18
programmer/migrations/0006_alter_recall_scan.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.7 on 2023-11-25 09:18
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('programmer', '0005_auto_20231124_1519'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='recall',
|
||||
name='scan',
|
||||
field=models.ImageField(upload_to='scan/%Y/%m/%d/', verbose_name='Фото'),
|
||||
),
|
||||
]
|
||||
31
programmer/migrations/0007_solution.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Generated by Django 4.2.7 on 2023-11-25 09:51
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('programmer', '0006_alter_recall_scan'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Solution',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=255, verbose_name='Наименование')),
|
||||
('description', models.TextField(blank=True, verbose_name='Описание')),
|
||||
('implementation', models.TextField(blank=True, verbose_name='Реализация')),
|
||||
('closing', models.TextField(blank=True, verbose_name='Заключение')),
|
||||
('time_create', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
|
||||
('time_update', models.DateTimeField(auto_now=True, verbose_name='Дата изменения')),
|
||||
('is_published', models.BooleanField(default=True, verbose_name='Опубликован')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Проекты',
|
||||
'verbose_name_plural': 'Проекты',
|
||||
'ordering': ['time_create', 'title'],
|
||||
},
|
||||
),
|
||||
]
|
||||
30
programmer/migrations/0008_home.py
Normal file
@ -0,0 +1,30 @@
|
||||
# Generated by Django 4.2.7 on 2023-11-25 10:45
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('programmer', '0007_solution'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Home',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=255, verbose_name='Наименование')),
|
||||
('content', models.TextField(blank=True, verbose_name='Статья')),
|
||||
('home_image', models.ImageField(upload_to='home_image/%Y/%m/%d/', verbose_name='Фото')),
|
||||
('time_create', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
|
||||
('time_update', models.DateTimeField(auto_now=True, verbose_name='Дата изменения')),
|
||||
('is_published', models.BooleanField(default=True, verbose_name='Опубликован')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Главная страница',
|
||||
'verbose_name_plural': 'Главная страница',
|
||||
'ordering': ['time_create', 'title'],
|
||||
},
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,34 @@
|
||||
# Generated by Django 4.2.7 on 2025-11-09 12:00
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('programmer', '0008_home'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='CallbackRequest',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=100, verbose_name='Имя')),
|
||||
('phone', models.CharField(max_length=20, verbose_name='Телефон')),
|
||||
('email', models.EmailField(max_length=254, verbose_name='Электронная почта')),
|
||||
('question', models.TextField(verbose_name='Ваш вопрос')),
|
||||
('time_create', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
|
||||
('is_processed', models.BooleanField(default=False, verbose_name='Обработано')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Заявка на звонок',
|
||||
'verbose_name_plural': 'Заявки на звонок',
|
||||
'ordering': ['-time_create'],
|
||||
},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='competence',
|
||||
options={'ordering': ['time_create', 'title'], 'verbose_name': 'Компетенция', 'verbose_name_plural': 'Компетенции'},
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,23 @@
|
||||
# Generated by Django 4.2.7 on 2025-11-09 12:09
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('programmer', '0009_callbackrequest_alter_competence_options'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='callbackrequest',
|
||||
name='email',
|
||||
field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='Электронная почта'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='callbackrequest',
|
||||
name='question',
|
||||
field=models.TextField(blank=True, verbose_name='Ваш вопрос'),
|
||||
),
|
||||
]
|
||||
41
programmer/migrations/0011_visitor_pageview.py
Normal file
@ -0,0 +1,41 @@
|
||||
# Generated by Django 4.2.26 on 2025-11-12 11:56
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('programmer', '0010_alter_callbackrequest_email_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Visitor',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ip_address', models.GenericIPAddressField()),
|
||||
('first_visit', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('last_visit', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('visit_count', models.IntegerField(default=1)),
|
||||
],
|
||||
options={
|
||||
'indexes': [models.Index(fields=['ip_address'], name='programmer__ip_addr_2c6dca_idx')],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='PageView',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('url', models.CharField(max_length=500)),
|
||||
('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('ip_address', models.GenericIPAddressField()),
|
||||
('user_agent', models.TextField(blank=True)),
|
||||
('referer', models.CharField(blank=True, max_length=500)),
|
||||
],
|
||||
options={
|
||||
'indexes': [models.Index(fields=['url', 'timestamp'], name='programmer__url_9a41b2_idx'), models.Index(fields=['timestamp'], name='programmer__timesta_070072_idx')],
|
||||
},
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,23 @@
|
||||
# Generated by Django 4.2.26 on 2025-11-14 10:36
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('programmer', '0011_visitor_pageview'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='callbackrequest',
|
||||
name='is_read',
|
||||
field=models.BooleanField(default=False, verbose_name='Прочитано'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='callbackrequest',
|
||||
name='notification_sent',
|
||||
field=models.BooleanField(default=False, verbose_name='Уведомление отправлено'),
|
||||
),
|
||||
]
|
||||