diff --git a/.gitignore b/.gitignore
index e3f5dc5..7f1c481 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ config_root_ids
__pycache__
log.txt
bot.db
+migrations
\ No newline at end of file
diff --git a/adminpanel/__init__.py b/adminpanel/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/adminpanel/asgi.py b/adminpanel/asgi.py
new file mode 100644
index 0000000..ea6cb00
--- /dev/null
+++ b/adminpanel/asgi.py
@@ -0,0 +1,16 @@
+"""
+ASGI config for adminpanel 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.1/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'adminpanel.settings')
+
+application = get_asgi_application()
diff --git a/adminpanel/settings.py b/adminpanel/settings.py
new file mode 100644
index 0000000..5719139
--- /dev/null
+++ b/adminpanel/settings.py
@@ -0,0 +1,134 @@
+"""
+Django settings for adminpanel project.
+
+Generated by 'django-admin startproject' using Django 4.1.4.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/4.1/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/4.1/ref/settings/
+"""
+import os
+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.1/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'django-insecure-13x&cmg=f1gx9u(i@s(xplh+4x=+@ucyujcqf2t3hu7@i(k=fe'
+
+# 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',
+ 'adminpanelapp'
+]
+
+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 = 'adminpanel.urls'
+
+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',
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = 'adminpanel.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
+
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'bot.db'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/4.1/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.1/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/4.1/howto/static-files/
+
+STATIC_URL = 'static/'
+
+# Default primary key field type
+# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
+
+DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
+
+ASGI_APPLICATION = 'adminpanelapp.asgi.application'
+ASYNC_MODE = 'django'
+g_telegram_bot_api_token = '6212211018:AAEwcEN0NdjbhqDiClUk8vZkE_vfRUxsReU'
+
+
+MEDIA_URL = '/media/'
+MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
+
diff --git a/adminpanel/urls.py b/adminpanel/urls.py
new file mode 100644
index 0000000..9e1d200
--- /dev/null
+++ b/adminpanel/urls.py
@@ -0,0 +1,11 @@
+from django.contrib import admin
+from django.urls import path, include
+from django.views.generic import RedirectView
+from django.conf import settings
+from django.conf.urls.static import static
+
+urlpatterns = [
+path('admin/', admin.site.urls),
+path('', include('adminpanelapp.urls')),
+path('', RedirectView.as_view(url='/admin/adminpanelapp/orders'), name='')
+] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
\ No newline at end of file
diff --git a/adminpanel/wsgi.py b/adminpanel/wsgi.py
new file mode 100644
index 0000000..fb11c1e
--- /dev/null
+++ b/adminpanel/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for adminpanel 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.1/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'adminpanel.settings')
+
+application = get_wsgi_application()
diff --git a/adminpanelapp/__init__.py b/adminpanelapp/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/adminpanelapp/admin.py b/adminpanelapp/admin.py
new file mode 100644
index 0000000..5b56fdf
--- /dev/null
+++ b/adminpanelapp/admin.py
@@ -0,0 +1,49 @@
+import requests
+from django.http import HttpResponseRedirect
+from django.utils.html import format_html
+from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
+
+from adminpanel.settings import g_telegram_bot_api_token
+from .models import Orders
+
+
+from django.contrib import admin, messages
+from django.urls import reverse
+
+
+
+class OrdersAdmin(admin.ModelAdmin):
+ list_display = ('orderName', 'orderCreateDateTime', 'show_orderPhoto', 'show_orderPhotoPay',)
+ actions =['change_value_and_redirect', ]
+ readonly_fields = ['orderPhoto', 'orderPhotoPay']
+
+
+ def show_orderPhoto(self, obj):
+ if obj.orderPhoto and obj.orderPhoto.url:
+ return format_html('', obj.orderPhoto.url)
+ return "-"
+ show_orderPhoto.short_description = 'Фото заказа'
+
+ def show_orderPhotoPay(self, obj):
+ if obj.orderPhotoPay and obj.orderPhotoPay.url:
+ return format_html('
', obj.orderPhotoPay.url)
+ return "-"
+ show_orderPhotoPay.short_description = 'Фото чека'
+
+
+ def change_value_and_redirect(orders, request, queryset):
+ selected_objects = request.POST.getlist(ACTION_CHECKBOX_NAME)
+ if len(selected_objects) != 1:
+ messages.error(request, "Выберите только один объект")
+ return
+
+ selected_user_id = int(selected_objects[0])
+ obj = queryset.get(orderID=selected_user_id)
+ user_id = obj.userID
+ url = reverse('send_telegram_message', kwargs={'chat_id': user_id})
+ return HttpResponseRedirect(url)
+
+
+ change_value_and_redirect.short_description = 'Отправка сообщения'
+
+admin.site.register(Orders, OrdersAdmin)
diff --git a/adminpanelapp/apps.py b/adminpanelapp/apps.py
new file mode 100644
index 0000000..f186ec5
--- /dev/null
+++ b/adminpanelapp/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class AdminpanelappConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'adminpanelapp'
diff --git a/adminpanelapp/models.py b/adminpanelapp/models.py
new file mode 100644
index 0000000..067f4cc
--- /dev/null
+++ b/adminpanelapp/models.py
@@ -0,0 +1,40 @@
+from django.db import models
+
+import asyncio
+
+
+class Orders(models.Model):
+ SEND_MESSAGE = (
+ (True, 'Написать'),
+ (False, 'Не отправлять'),
+ (None, 'Неизвестно'),
+ )
+
+ IS_APPROVED = (
+ (True, 'Заказ подтвержден'),
+ (False, 'Заказ не подтвержден'),
+ (None, 'Неизвестно'),
+ )
+
+
+ orderID = models.AutoField(primary_key=True, verbose_name='id заказа')
+ userID = models.CharField(max_length=100, verbose_name='id пользователя в tg', null=True)
+ orderName = models.CharField(max_length=100, verbose_name='наименование', null=True)
+ orderDesc = models.TextField(verbose_name='описание', null=True)
+ orderPhoto = models.ImageField(upload_to='photo/', verbose_name='фото')
+ orderPhotoPay = models.ImageField(upload_to='photo/', verbose_name='чек')
+ orderAddress = models.CharField(max_length=100, verbose_name='адрес доставки', blank=True, null=True)
+ orderAccess = models.CharField(max_length=100, verbose_name='доступ', blank=True, null=True)
+ orderCreateDateTime = models.DateTimeField(auto_now_add=True, null=True, verbose_name='дата и время создания')
+ orderStatus = models.CharField(max_length=100, verbose_name='статус заказа', blank=True, null=True)
+
+
+
+ class Meta:
+ # app_label = 'adminpanel'
+ verbose_name_plural = 'Заказы'
+ managed = False
+ db_table = 'orders'
+
+ # def __str__(self):
+ # return self.name
\ No newline at end of file
diff --git a/adminpanelapp/templates/__init__.py b/adminpanelapp/templates/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/adminpanelapp/templates/send_telegram_message.html b/adminpanelapp/templates/send_telegram_message.html
new file mode 100644
index 0000000..4644d06
--- /dev/null
+++ b/adminpanelapp/templates/send_telegram_message.html
@@ -0,0 +1,6 @@
+