diff --git a/.gitignore b/.gitignore index e3f5dc5..97c1edd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ config_root_ids __pycache__ log.txt bot.db +adminpanelapp/migrations +adminpanel/__init__.py +.env \ No newline at end of file diff --git a/adminpanel/__init__.py b/adminpanel/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/adminpanel/asgi.py b/adminpanel/asgi.py deleted file mode 100644 index 65ed7db..0000000 --- a/adminpanel/asgi.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -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.2/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/urls.py b/adminpanel/urls.py deleted file mode 100644 index 6f7db62..0000000 --- a/adminpanel/urls.py +++ /dev/null @@ -1,11 +0,0 @@ -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='') -] \ No newline at end of file diff --git a/adminpanel/wsgi.py b/adminpanel/wsgi.py deleted file mode 100644 index d976b1e..0000000 --- a/adminpanel/wsgi.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -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.2/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 deleted file mode 100644 index e69de29..0000000 diff --git a/adminpanelapp/admin.py b/adminpanelapp/admin.py deleted file mode 100644 index e066c49..0000000 --- a/adminpanelapp/admin.py +++ /dev/null @@ -1,44 +0,0 @@ -from django.http import HttpResponseRedirect -from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME -from django.utils.safestring import mark_safe -from .models import Orders - - -from django.contrib import admin, messages -from django.urls import reverse - - - -class OrdersAdmin(admin.ModelAdmin): - list_display = ('orderName', 'orderCreateDateTime', 'orderDesc', 'orderAddress', 'show_photo', 'show_photopay') - actions =['send_message'] - exclude = ['orderAccess', 'userID', 'orderPhoto', 'orderPhotoPay'] - - def show_photo(self, obj): - html = obj.get_photo_html() - return mark_safe(html) - - show_photo.short_description = 'Фото' - - def show_photopay(self, obj): - html = obj.get_photopay_html() - return mark_safe(html) - - show_photopay.short_description = 'Чек' - - def send_message(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) - - - send_message.short_description = 'Отправка сообщения' - -admin.site.register(Orders, OrdersAdmin) diff --git a/adminpanelapp/apps.py b/adminpanelapp/apps.py deleted file mode 100644 index f186ec5..0000000 --- a/adminpanelapp/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class AdminpanelappConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'adminpanelapp' diff --git a/adminpanelapp/migrations/__init__.py b/adminpanelapp/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/adminpanelapp/tests.py b/adminpanelapp/tests.py deleted file mode 100644 index 7ce503c..0000000 --- a/adminpanelapp/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/adminpanelapp/urls.py b/adminpanelapp/urls.py deleted file mode 100644 index 989f17d..0000000 --- a/adminpanelapp/urls.py +++ /dev/null @@ -1,10 +0,0 @@ -from django.urls import path, include -from .views import send_telegram_message - - -urlpatterns = [ - path('send_telegram_message//', send_telegram_message, name='send_telegram_message'), - - - -] \ No newline at end of file diff --git a/bot_sys/config.py b/bot_sys/config.py index 8421116..77d795b 100644 --- a/bot_sys/config.py +++ b/bot_sys/config.py @@ -24,8 +24,12 @@ root_ids_file_name = 'config_root_ids' # Дополнительные функции def ClearReadLine(a_Line): +<<<<<<< HEAD line = a_Line.strip() return line +======= + return a_Line[:-1] +>>>>>>> parent of 88fcd3e (админпанель для бота #5) def GetFirstLineFromFile(a_FileName): f = open(a_FileName, 'r') diff --git a/manage.py b/manage.py deleted file mode 100644 index b64513a..0000000 --- a/manage.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/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', 'adminpanel.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/template/bd_item_add.py b/template/bd_item_add.py index 542e14e..54c6960 100644 --- a/template/bd_item_add.py +++ b/template/bd_item_add.py @@ -82,7 +82,7 @@ def FinishOrNextAddBDItemTemplate(a_Bot, a_FSM, a_AddBDItemFunc, a_ParentTableNa if a_Message.photo == None or len(a_Message.photo) == 0: await state.finish() return simple_message.WorkFuncResult(bot_messages.MakeBotMessage(error_photo_type_message), keyboard_func = a_FinishButtonFunc) - field_value = a_Message.photo[-1].file_id + field_value = a_Message.photo[0].file_id else: result = a_Message.text if a_PostProcessFunc: