chore [P-0]: сhore
This commit is contained in:
1 parent
d13d02fadb
commit
2e48e08b83
389 files changed
+17307
-11020
No files matched your search
Regular → Executable
File mode changed.
@@ -49,14 +49,14 @@ BACKEND_INTERNAL_PORT=8000
|
|||||||
|
|
||||||
DOCKER_RESTART="unless-stopped"
|
DOCKER_RESTART="unless-stopped"
|
||||||
|
|
||||||
DOCS_EXTERNAL_PORT=5173
|
|
||||||
DOCS_INTERNAL_PORT=5173
|
|
||||||
NGINX_EXTERNAL_PORT=80
|
NGINX_EXTERNAL_PORT=80
|
||||||
NGINX_INTERNAL_PORT=80
|
NGINX_INTERNAL_PORT=80
|
||||||
|
|
||||||
RUN_WITH_DOCS=False
|
|
||||||
PRODUCTION=True
|
PRODUCTION=True
|
||||||
|
APT_PROXY='172.16.200.28:3142'
|
||||||
|
PIP_INDEX_URL='pip.oktp'
|
||||||
|
NPM_REGISTRY="https://npm.oktp/"
|
||||||
MYDEBUG=False
|
MYDEBUG=False
|
||||||
DJANGO_CSRF_TRUSTED_ORIGINS="http://localhost, http://portal-t, http://127.0.0.1, http://portal9966/"
|
DJANGO_CSRF_TRUSTED_ORIGINS="http://localhost, http://portal-t, http://127.0.0.1, http://portal9966/"
|
||||||
DJANGO_ALLOWED_HOSTS="*, portal-t, portal9966, localhost, 0.0.0.0"
|
DJANGO_ALLOWED_HOSTS="*, portal-t, portal9966, localhost, 0.0.0.0"
|
||||||
Regular → Executable
-3
@@ -1,6 +1,3 @@
|
|||||||
RUN_WITH_DOCS=False
|
|
||||||
|
|
||||||
AUTO_BACKEND=False
|
|
||||||
|
|
||||||
DB_NAME="accounting"
|
DB_NAME="accounting"
|
||||||
DB_USER="root"
|
DB_USER="root"
|
||||||
|
|||||||
Regular → Executable
File mode changed.
Executable
+20
@@ -0,0 +1,20 @@
|
|||||||
|
# --- Владельцы всего репозитория по умолчанию (если не подошло ничего ниже) ---
|
||||||
|
* @Nukeap @Vitaly
|
||||||
|
|
||||||
|
# --- Бэкенд (Django / Python) ---
|
||||||
|
# Любые изменения в папке back требуют ревью от Yaroslav
|
||||||
|
src/back/.* @Yaroslav_Pechenkin @Nukeap @Vitaly
|
||||||
|
|
||||||
|
# --- База данных (Миграции) ---
|
||||||
|
# Миграции нельзя менять без разрешения Yaroslav (чтобы случайно не сломать БД)
|
||||||
|
src/back/.*/migrations/.* @Nukeap @Vitaly
|
||||||
|
|
||||||
|
# --- Фронтенд (Vue / TypeScript) ---
|
||||||
|
# Любые изменения во фронтенде требуют ревью от Denzel или inna
|
||||||
|
src/front/.* @Denzel @inna
|
||||||
|
|
||||||
|
# --- Конфигурация CI/CD и Docker ---
|
||||||
|
# Изменения в пайплайнах и докере требуют ревью от Nukeap (вас)
|
||||||
|
.gitea/workflows/.* @Nukeap
|
||||||
|
docker-compose.*.yml @Nukeap
|
||||||
|
Dockerfile @Nukeap
|
||||||
Regular → Executable
+1
-1
@@ -16,4 +16,4 @@ easyrestore
|
|||||||
easymanage
|
easymanage
|
||||||
easydockersave
|
easydockersave
|
||||||
easyserver
|
easyserver
|
||||||
#
|
.idea/
|
||||||
Generated
-10
@@ -1,10 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Ignored default folder with query files
|
|
||||||
/queries/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
Generated
-8
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
Generated
-59
@@ -1,59 +0,0 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
|
||||||
<code_scheme name="Project" version="173">
|
|
||||||
<HTMLCodeStyleSettings>
|
|
||||||
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
||||||
</HTMLCodeStyleSettings>
|
|
||||||
<JSCodeStyleSettings version="0">
|
|
||||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
||||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
||||||
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
||||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
||||||
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
||||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
||||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
||||||
</JSCodeStyleSettings>
|
|
||||||
<TypeScriptCodeStyleSettings version="0">
|
|
||||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
||||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
||||||
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
||||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
||||||
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
||||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
||||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
||||||
</TypeScriptCodeStyleSettings>
|
|
||||||
<VueCodeStyleSettings>
|
|
||||||
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
|
||||||
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
|
||||||
</VueCodeStyleSettings>
|
|
||||||
<codeStyleSettings language="HTML">
|
|
||||||
<option name="SOFT_MARGINS" value="100" />
|
|
||||||
<indentOptions>
|
|
||||||
<option name="INDENT_SIZE" value="2" />
|
|
||||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
||||||
<option name="TAB_SIZE" value="2" />
|
|
||||||
</indentOptions>
|
|
||||||
</codeStyleSettings>
|
|
||||||
<codeStyleSettings language="JavaScript">
|
|
||||||
<option name="SOFT_MARGINS" value="100" />
|
|
||||||
<indentOptions>
|
|
||||||
<option name="INDENT_SIZE" value="2" />
|
|
||||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
||||||
<option name="TAB_SIZE" value="2" />
|
|
||||||
</indentOptions>
|
|
||||||
</codeStyleSettings>
|
|
||||||
<codeStyleSettings language="TypeScript">
|
|
||||||
<option name="SOFT_MARGINS" value="100" />
|
|
||||||
<indentOptions>
|
|
||||||
<option name="INDENT_SIZE" value="2" />
|
|
||||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
||||||
<option name="TAB_SIZE" value="2" />
|
|
||||||
</indentOptions>
|
|
||||||
</codeStyleSettings>
|
|
||||||
<codeStyleSettings language="Vue">
|
|
||||||
<option name="SOFT_MARGINS" value="100" />
|
|
||||||
<indentOptions>
|
|
||||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
||||||
</indentOptions>
|
|
||||||
</codeStyleSettings>
|
|
||||||
</code_scheme>
|
|
||||||
</component>
|
|
||||||
Generated
-5
@@ -1,5 +0,0 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
|
||||||
<state>
|
|
||||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
|
||||||
</state>
|
|
||||||
</component>
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
||||||
Generated
-8
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/PORTAL_COD2.iml" filepath="$PROJECT_DIR$/.idea/PORTAL_COD2.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Generated
-7
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Regular → Executable
+10
-13
@@ -10,7 +10,7 @@ clear_directory() {
|
|||||||
}
|
}
|
||||||
# Функция для вывода переменных, определенных во время исполнения скрипта
|
# Функция для вывода переменных, определенных во время исполнения скрипта
|
||||||
print_script_variables() {
|
print_script_variables() {
|
||||||
set | sort | comm -13 .env.tmp -
|
LC_ALL=C comm -13 <(LC_ALL=C sort .env.tmp) <(set | LC_ALL=C sort)
|
||||||
}
|
}
|
||||||
# Мина разработчикам с правилами гит-хуков
|
# Мина разработчикам с правилами гит-хуков
|
||||||
git config core.hooksPath .git-hooks
|
git config core.hooksPath .git-hooks
|
||||||
@@ -29,7 +29,8 @@ cp -n ${PROJECT_DIR}/.env.local.sample ${PROJECT_DIR}/.env.local
|
|||||||
if [[ -f .env.local ]]; then
|
if [[ -f .env.local ]]; then
|
||||||
source ".env.local"
|
source ".env.local"
|
||||||
fi
|
fi
|
||||||
|
REAL_UID=${SUDO_UID:-$(id -u)}
|
||||||
|
REAL_GID=${SUDO_GID:-$(id -g)}
|
||||||
# Создаем директорию с локальными фойлами
|
# Создаем директорию с локальными фойлами
|
||||||
mkdir -p "${LOCAL_FILES_DIR}"
|
mkdir -p "${LOCAL_FILES_DIR}"
|
||||||
|
|
||||||
@@ -95,20 +96,21 @@ mkdir -p "${LOCAL_FILES_DIR}/front/"
|
|||||||
export NGINX_EXTERNAL_PORT=${NGINX_EXTERNAL_PORT}
|
export NGINX_EXTERNAL_PORT=${NGINX_EXTERNAL_PORT}
|
||||||
export BACKEND_EXTERNAL_PORT=${BACKEND_EXTERNAL_PORT}
|
export BACKEND_EXTERNAL_PORT=${BACKEND_EXTERNAL_PORT}
|
||||||
export FRONTEND_EXTERNAL_PORT=${FRONTEND_EXTERNAL_PORT}
|
export FRONTEND_EXTERNAL_PORT=${FRONTEND_EXTERNAL_PORT}
|
||||||
export DOCS_EXTERNAL_PORT=${DOCS_EXTERNAL_PORT}
|
|
||||||
export HOST_NAME=${HOST_NAME}
|
export HOST_NAME=${HOST_NAME}
|
||||||
|
export REAL_UID REAL_GID
|
||||||
|
|
||||||
|
VERSION=$(grep '"version"' ${PROJECT_DIR}/src/front/package.json | sed -n 's/.*"version": "\([^"]*\)".*/\1/p')
|
||||||
|
echo "Version: $VERSION"
|
||||||
# if [[ "${PRODUCTION}" != "False" ]]; then
|
# if [[ "${PRODUCTION}" != "False" ]]; then
|
||||||
# echo "Сборка версии для сервера!"
|
# echo "Сборка версии для сервера!"
|
||||||
envsubst '${NGINX_EXTERNAL_PORT},${BACKEND_EXTERNAL_PORT},${DOCS_EXTERNAL_PORT},${FRONTEND_EXTERNAL_PORT},${HOST_NAME}' \
|
envsubst '${NGINX_EXTERNAL_PORT},${BACKEND_EXTERNAL_PORT},${FRONTEND_EXTERNAL_PORT},${HOST_NAME}' \
|
||||||
< "${CONFS_DIR}/nginx/nginx.prod.conf" > \
|
< "${CONFS_DIR}/nginx/nginx.prod.conf" > \
|
||||||
"${LOCAL_FILES_DIR}/nginx/conf/nginx.prod.conf"
|
"${LOCAL_FILES_DIR}/nginx/conf/nginx.prod.conf"
|
||||||
# # Следующие команды заполняют шаблон значениями переменных окружения
|
# # Следующие команды заполняют шаблон значениями переменных окружения
|
||||||
# else
|
# else
|
||||||
# echo "Сборка версии для РАЗРАБОТКИ!"
|
# echo "Сборка версии для РАЗРАБОТКИ!"
|
||||||
envsubst '${NGINX_EXTERNAL_PORT},${BACKEND_EXTERNAL_PORT},${DOCS_EXTERNAL_PORT},${FRONTEND_EXTERNAL_PORT},${HOST_NAME}' \
|
envsubst '${NGINX_EXTERNAL_PORT},${BACKEND_EXTERNAL_PORT},${FRONTEND_EXTERNAL_PORT},${HOST_NAME}' \
|
||||||
< "${CONFS_DIR}/nginx/nginx.dev.conf" > \
|
< "${CONFS_DIR}/nginx/nginx.dev.conf" > \
|
||||||
"${LOCAL_FILES_DIR}/nginx/conf/nginx.dev.conf"
|
"${LOCAL_FILES_DIR}/nginx/conf/nginx.dev.conf"
|
||||||
# fi
|
# fi
|
||||||
@@ -121,11 +123,6 @@ envsubst '${NGINX_EXTERNAL_PORT},${BACKEND_EXTERNAL_PORT},${DOCS_EXTERNAL_PORT},
|
|||||||
|
|
||||||
# Дополнение docker-compose.yaml в зависимости от значений переменных окружения
|
# Дополнение docker-compose.yaml в зависимости от значений переменных окружения
|
||||||
|
|
||||||
if [[ "${RUN_WITH_DOCS}" = "True" ]]; then
|
|
||||||
echo $DOCKER_COMPOSES_DIR
|
|
||||||
COMPOSE_FILE="${COMPOSE_FILE} -f ${DOCKER_COMPOSES_DIR}/docker-compose.docs.yml"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [[ "${PRODUCTION}" != "False" ]]; then
|
if [[ "${PRODUCTION}" != "False" ]]; then
|
||||||
echo "Сборка версии для сервера!"
|
echo "Сборка версии для сервера!"
|
||||||
@@ -149,7 +146,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
EXCLUDE_RULES="^\(SHLVL=\|LINES=\|COLUMNS=\|BASH_SOURCE=\|BASH_LINENO=\|BASH_ARGV=\|BASH_ARGC=\|EXCLUDE_RULES=\|_=\|FUNCNAME=\|PIPESTATUS=\)"
|
EXCLUDE_RULES="^$SHLVL=\|LINES=\|COLUMNS=\|BASH_SOURCE=\|BASH_LINENO=\|BASH_ARGV=\|BASH_ARGC=\|EXCLUDE_RULES=\|_=\|FUNCNAME=\|PIPESTATUS=\|.*SECRET=\|.*TOKEN=$"
|
||||||
print_script_variables | grep -v $EXCLUDE_RULES > ${PROJECT_DIR}/.env
|
print_script_variables | grep -v $EXCLUDE_RULES > ${PROJECT_DIR}/.env
|
||||||
|
|
||||||
# Удаляем временный файл
|
# Удаляем временный файл
|
||||||
|
|||||||
Regular → Executable
File mode changed.
@@ -1,121 +1 @@
|
|||||||
# IS#26 Портал ЦОД-2
|
# ПОРТАЛ
|
||||||
|
|
||||||
[Общие работы по проекту](/COD2/PORTAL_COD2/projects/22)
|
|
||||||
|
|
||||||
|
|
||||||
Prod Portal9966/ (10.252.44.28)
|
|
||||||
Test Potal-t/ (10.252.44.60)
|
|
||||||
|
|
||||||
## Стэк ##
|
|
||||||
1. Python 3.10
|
|
||||||
2. Vuetify3
|
|
||||||
3. MySQL
|
|
||||||
4. Redis
|
|
||||||
|
|
||||||
## Особенности веток ##
|
|
||||||
У разработчиков у каждого своя ветка.
|
|
||||||
|
|
||||||
npm version patch производится на ветке razrab
|
|
||||||
|
|
||||||
окончательная сборка - на main
|
|
||||||
## Схема ##
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
flowchart TD
|
|
||||||
A[Клиент] <-->|Запрос к серверу PORTAL9966/ или PORTAL-t/| B{Nginx:80}
|
|
||||||
B <-->|Фронт /| C[Vuetify 3 <br/> /var/www/PORTAL_COD2/src/front/dist]
|
|
||||||
B <-->|бэк <br/> /api <br/> /admin <br/> /ws| D{Daphne :9966}
|
|
||||||
D<--> |/ws| E[Django channels]
|
|
||||||
E<-->F[Redis :6379]
|
|
||||||
D<-->|Admin|G{Django}
|
|
||||||
G<-->|10.252.44.13:8005|H[Авторизация FAST API сервер]
|
|
||||||
H<-->J[Active Directory]
|
|
||||||
G<-->|10.252.44.33:3306|I[MySQL <br/> БД Справочник]
|
|
||||||
B<-->|/static <br/> /media|K[Файлы <br/> /var/www/PORTAL_COD2/src/media <br/> /var/www/PORTAL_COD2/src/static/ ]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Установка и настройка ##
|
|
||||||
|
|
||||||
### Первоначальная установка после клонирования в папку. В случае неисправностей, идти примерно по этому же пути ###
|
|
||||||
|
|
||||||
Инициализация проекта:
|
|
||||||
|
|
||||||
- Инициализировать git
|
|
||||||
- Выполнить git clone
|
|
||||||
|
|
||||||
1. В каталоге проекта Создаем окружение
|
|
||||||
|
|
||||||
``` python3.10 -m venv env ```
|
|
||||||
|
|
||||||
2. Активируем окружение
|
|
||||||
|
|
||||||
``` source env/bin/activate```
|
|
||||||
|
|
||||||
3. устанавливаем необходимые пакеты
|
|
||||||
|
|
||||||
``` cd sys ```
|
|
||||||
```pip install -r r.txt --proxy= http://...```
|
|
||||||
|
|
||||||
Если нет proxy:
|
|
||||||
|
|
||||||
На машине разработки выполнить команду ```pip download -r ../r.txt```
|
|
||||||
|
|
||||||
Команда для установки python
|
|
||||||
```pip install --no-index --find-links /Путь_К_Папке_С_Пакетами/ -r r.txt```
|
|
||||||
|
|
||||||
Запушить изменения в ветку
|
|
||||||
|
|
||||||
Синхронизировать ветку на сервере
|
|
||||||
|
|
||||||
``` git pull ```
|
|
||||||
|
|
||||||
Если произошла ошибка: ``` git reset --hard ```
|
|
||||||
|
|
||||||
4. переходим в каталог src
|
|
||||||
|
|
||||||
``` cd ../src/```
|
|
||||||
|
|
||||||
5. В каталог src разархивируем portal.zip из sys
|
|
||||||
Прописываем подключения в settings.py
|
|
||||||
|
|
||||||
|
|
||||||
6. Для проверки запускаем сервер разработки
|
|
||||||
|
|
||||||
```python manage.py runserver```
|
|
||||||
|
|
||||||
Если в консоли не появляются ошибки и сервер стартует, переходим далее. В противном случае - доустанавливаем необходимые пакеты.
|
|
||||||
|
|
||||||
7. останавливаем сервер разработки (CTRL+C)
|
|
||||||
|
|
||||||
На этом работы непосредственно с бэкэндом завершены
|
|
||||||
### Порты ###
|
|
||||||
Daphne: 9966
|
|
||||||
|
|
||||||
### Настройка NGINX, GUNICORN, Vuetify, Daphne ###
|
|
||||||
В каталоге sys расположены примерные файлы конфигов для тестового и боевого серверов
|
|
||||||
|
|
||||||
Тестовый сервер: /sys/test_server
|
|
||||||
|
|
||||||
При копировании убедиться, что пути соответствуют системе
|
|
||||||
#### NGINX Vuetify ####
|
|
||||||
Стандартный путь для файлов .conf
|
|
||||||
/etc/nginx/sites-enabled
|
|
||||||
|
|
||||||
|
|
||||||
#### Daphne ####
|
|
||||||
Файлы .service кладем в каталог /etc/systemd/system
|
|
||||||
|
|
||||||
Проверяем путь виртуального окружения и порт в файле на соответствие с конфигурацией Nginx
|
|
||||||
|
|
||||||
#### Запуск сервера ####
|
|
||||||
Запускаем Daphne ``` Start portaldaphne ```
|
|
||||||
Перезагружаем Nginx ``` Restart nginx ```
|
|
||||||
|
|
||||||
## Резервное копирование
|
|
||||||
```mermaid
|
|
||||||
graph TD;
|
|
||||||
M-.->|Вручную|Maestro
|
|
||||||
M[Main/Sulaco]--o|Раз в сутки|B[BigBox]
|
|
||||||
```
|
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
+2
@@ -20,6 +20,8 @@ x-backend-base: &backend-base
|
|||||||
context: .
|
context: .
|
||||||
|
|
||||||
args:
|
args:
|
||||||
|
PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple}
|
||||||
|
APT_PROXY: ${APT_PROXY}
|
||||||
SOURCE_DIR: ./src/back
|
SOURCE_DIR: ./src/back
|
||||||
PROJECT_DIR: .
|
PROJECT_DIR: .
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
+6
@@ -21,12 +21,17 @@ services:
|
|||||||
- "${DB_PORT}:${DB_PORT}"
|
- "${DB_PORT}:${DB_PORT}"
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
|
image: portal-backend:latest
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/dockerfiles/back_dev
|
dockerfile: docker/dockerfiles/back_dev
|
||||||
args:
|
args:
|
||||||
SOURCE_DIR: ./src/back
|
SOURCE_DIR: ./src/back
|
||||||
PROJECT_DIR: .
|
PROJECT_DIR: .
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- redis
|
- redis
|
||||||
@@ -52,6 +57,7 @@ services:
|
|||||||
|
|
||||||
build:
|
build:
|
||||||
args:
|
args:
|
||||||
|
NPM_REGISTRY: ${NPM_REGISTRY}
|
||||||
SOURCE_DIR: ./src/front
|
SOURCE_DIR: ./src/front
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/dockerfiles/front_dev
|
dockerfile: docker/dockerfiles/front_dev
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
services:
|
|
||||||
documentation:
|
|
||||||
|
|
||||||
restart:
|
|
||||||
always
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: ${DOCKER_DOCKERFILES_DIR}/docfront
|
|
||||||
volumes:
|
|
||||||
|
|
||||||
- ./documentation:/app/documentation
|
|
||||||
- ./src/front/src:/app/src/front/src
|
|
||||||
- /app/src/front/src/node_modules/
|
|
||||||
- /app/documentation/node_modules/
|
|
||||||
- /app/node_modules/
|
|
||||||
- /app/documentation/docs/public/
|
|
||||||
|
|
||||||
ports:
|
|
||||||
- 5173:5173
|
|
||||||
|
|
||||||
command: ["sh", "-c", "npx vue-md-parser && npx jest && npx vitepress dev docs --host 0.0.0.0"]
|
|
||||||
networks:
|
|
||||||
- dev
|
|
||||||
|
|
||||||
|
|
||||||
networks:
|
|
||||||
dev:
|
|
||||||
driver: bridge
|
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
+11
-18
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.10.13-slim AS builderstage
|
FROM python:3.13.13-slim AS builderstage
|
||||||
|
|
||||||
WORKDIR /back
|
WORKDIR /back
|
||||||
|
|
||||||
@@ -11,27 +11,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
pkg-config && \
|
pkg-config && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
ARG APT_PROXY=""
|
||||||
|
ARG PIP_INDEX_URL
|
||||||
|
ENV POETRY_NO_INTERACTION=1
|
||||||
|
ENV PIP_TRUSTED_HOST=pip.local
|
||||||
|
|
||||||
# Копируем файлы зависимостей в контейнер
|
# Копируем файлы зависимостей в контейнер
|
||||||
COPY ${SOURCE_DIR}/pyproject.toml ${SOURCE_DIR}/README.md ./
|
COPY ${SOURCE_DIR}/pyproject.toml ${SOURCE_DIR}/poetry.toml ${SOURCE_DIR}/poetry.lock ${SOURCE_DIR}/README.md ./
|
||||||
COPY docker/entries/backend-entrypoint.sh /script/backend-entrypoint.sh
|
COPY docker/entries/backend-entrypoint.sh /script/backend-entrypoint.sh
|
||||||
|
|
||||||
RUN chmod 777 /script/backend-entrypoint.sh && \
|
RUN chmod 777 /script/backend-entrypoint.sh && \
|
||||||
python -m pip install --no-cache-dir poetry \
|
pip install --index-url https://${PIP_INDEX_URL}/root/pypi/+simple/ --trusted-host ${PIP_INDEX_URL} --no-cache-dir --upgrade pip && \
|
||||||
&& poetry config virtualenvs.in-project true \
|
pip install --index-url https://${PIP_INDEX_URL}/root/pypi/+simple/ --trusted-host ${PIP_INDEX_URL} --no-cache-dir poetry && \
|
||||||
&& poetry install --no-interaction --no-ansi
|
# Убираем возможный старый venv из кэша
|
||||||
|
poetry install --with dev --no-interaction --no-ansi
|
||||||
|
|
||||||
# Устанавливаем зависимости
|
|
||||||
# RUN python -m venv env
|
|
||||||
# RUN pip install --no-cache-dir -r r.txt
|
|
||||||
|
|
||||||
|
|
||||||
# Копируем все файлы проекта в контейнер
|
|
||||||
# COPY ${SOURCE_DIR} .
|
|
||||||
# FROM python:3.10.13-slim
|
|
||||||
# RUN python -m pip install --no-cache-dir poetry
|
|
||||||
|
|
||||||
# COPY --from=builderstage /script /script
|
|
||||||
# WORKDIR /back
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
#CMD ["tail", "-f", "/dev/null"]
|
||||||
Regular → Executable
+8
-4
@@ -1,4 +1,4 @@
|
|||||||
FROM node:lts-alpine as bstage
|
FROM node:lts-alpine AS bstage
|
||||||
|
|
||||||
ARG SOURCE_DIRFRONT
|
ARG SOURCE_DIRFRONT
|
||||||
ENV SOURCE_DIR=${SOURCE_DIRFRONT}
|
ENV SOURCE_DIR=${SOURCE_DIRFRONT}
|
||||||
@@ -12,7 +12,7 @@ COPY ${SOURCE_DIRFRONT}/*.cjs ./
|
|||||||
COPY ${SOURCE_DIRFRONT}/.* ./
|
COPY ${SOURCE_DIRFRONT}/.* ./
|
||||||
|
|
||||||
COPY ${SOURCE_DIR}/*.js ./
|
COPY ${SOURCE_DIR}/*.js ./
|
||||||
RUN npm cache clean --force && npm install
|
RUN npm ci
|
||||||
|
|
||||||
COPY ${SOURCE_DIRFRONT} ./
|
COPY ${SOURCE_DIRFRONT} ./
|
||||||
|
|
||||||
@@ -27,7 +27,12 @@ WORKDIR /back
|
|||||||
ARG SOURCE_DIR
|
ARG SOURCE_DIR
|
||||||
ENV SOURCE_DIR=${SOURCE_DIR}
|
ENV SOURCE_DIR=${SOURCE_DIR}
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends rsync \
|
RUN set -eux; \
|
||||||
|
if [ -n "$APT_PROXY" ]; then \
|
||||||
|
printf 'Acquire::http::Proxy "http://%s";\nAcquire::https::Proxy "http://%s";\n' "$APT_PROXY" "$APT_PROXY" > /etc/apt/apt.conf.d/99proxy; \
|
||||||
|
fi; \
|
||||||
|
sed -i '/^Components:/ s/$/ non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources; \
|
||||||
|
apt-get update && apt-get install -y --no-install-recommends rsync \
|
||||||
libmariadb-dev-compat \
|
libmariadb-dev-compat \
|
||||||
build-essential \
|
build-essential \
|
||||||
pkg-config && \
|
pkg-config && \
|
||||||
@@ -41,7 +46,6 @@ COPY docker/entries/backend-entrypoint.sh /script/backend-entrypoint.sh
|
|||||||
|
|
||||||
RUN chmod 777 /script/backend-entrypoint.sh && \
|
RUN chmod 777 /script/backend-entrypoint.sh && \
|
||||||
python -m pip install --no-cache-dir poetry \
|
python -m pip install --no-cache-dir poetry \
|
||||||
&& poetry config virtualenvs.in-project true \
|
|
||||||
&& poetry install --no-interaction --no-ansi
|
&& poetry install --no-interaction --no-ansi
|
||||||
##--without dev,test
|
##--without dev,test
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
FROM node:lts-alpine as buildstage
|
|
||||||
|
|
||||||
# Установить рабочую директорию
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
|
|
||||||
RUN npm cache clean --force && npm install @babel/plugin-proposal-unicode-property-regex \
|
|
||||||
@babel/preset-env @babel/preset-modules \
|
|
||||||
babel-jest @babel/runtime @babel/plugin-transform-runtime
|
|
||||||
|
|
||||||
WORKDIR /app/documentation
|
|
||||||
# Очистить кэш npm и установить необходимые пакеты
|
|
||||||
RUN npm cache clean --force && npm install --prefix ./ vitepress vue-md-parser @vue/vue3-jest \
|
|
||||||
@babel/plugin-proposal-unicode-property-regex \
|
|
||||||
@babel/preset-env @babel/preset-modules babel-jest @babel/runtime \
|
|
||||||
axios @babel/plugin-transform-runtime \
|
|
||||||
babel-jest jest jest-environment-jsdom @jest/globals \
|
|
||||||
@vue/cli-plugin-babel @vue/compiler-dom @vue/server-renderer @vue/test-utils \
|
|
||||||
jest-transform-stub && \
|
|
||||||
mkdir -p /app/documentation/docs/public/test-coverage/src/ &&\
|
|
||||||
chmod 777 /app/documentation/docs/public/test-coverage/src/
|
|
||||||
|
|
||||||
COPY ./documentation/babel.config.cjs /app
|
|
||||||
WORKDIR /app/src/front/
|
|
||||||
COPY ./src/front/package.json .
|
|
||||||
RUN npm cache clean --force && npm install
|
|
||||||
# Открыть порт для VitePress
|
|
||||||
|
|
||||||
FROM node:lts-alpine
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=buildstage /app .
|
|
||||||
EXPOSE 5173
|
|
||||||
WORKDIR /app/documentation/
|
|
||||||
# Держать контейнер запущенным
|
|
||||||
# CMD ["tail", "-f", "/dev/null"]
|
|
||||||
# Раскомментируйте следующую строку, чтобы запустить приложение
|
|
||||||
# CMD ["sh", "-c", "npx vue-md-parser && npx jest && npx vitepress dev docs --host 0.0.0.0"]
|
|
||||||
Regular → Executable
+4
-7
@@ -1,20 +1,17 @@
|
|||||||
# Используем официальный образ Node.js на базе Alpine
|
# Используем официальный образ Node.js на базе Alpine
|
||||||
FROM node:lts-alpine as buildstage
|
FROM node:lts-alpine AS buildstage
|
||||||
|
|
||||||
|
|
||||||
ARG SOURCE_DIR
|
ARG SOURCE_DIR
|
||||||
ENV SOURCE_DIR=${SOURCE_DIR}
|
ENV SOURCE_DIR=${SOURCE_DIR}
|
||||||
# Устанавливаем рабочую директорию
|
# Устанавливаем рабочую директорию
|
||||||
|
ARG NPM_REGISTRY=https://registry.npmjs.org/
|
||||||
|
ENV NPM_REGISTRY=${NPM_REGISTRY}
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY ${SOURCE_DIR}/* ./
|
COPY ${SOURCE_DIR}/* ./
|
||||||
|
|
||||||
RUN npm cache clean --force && npm install
|
RUN npm ci
|
||||||
|
|
||||||
# Копируем остальные файлы приложения
|
|
||||||
# COPY ${SOURCE_DIR} ./
|
|
||||||
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
# COPY . .
|
# COPY . .
|
||||||
|
|||||||
Regular → Executable
+10
-12
@@ -5,23 +5,21 @@ do
|
|||||||
echo "Жду запуска сервера..."
|
echo "Жду запуска сервера..."
|
||||||
done
|
done
|
||||||
|
|
||||||
# until poetry run python manage.py makemigrations
|
until poetry run python manage.py makemigrations
|
||||||
# do
|
do
|
||||||
# echo "Создаю миграции..."
|
echo "Создаю миграции..."
|
||||||
# done
|
done
|
||||||
|
|
||||||
|
|
||||||
# until poetry run python manage.py migrate
|
until poetry run python manage.py migrate
|
||||||
# do
|
do
|
||||||
# echo "Применяю при необходимости..."
|
echo "Применяю при необходимости..."
|
||||||
# sleep 2
|
sleep 2
|
||||||
# done
|
done
|
||||||
poetry run python manage.py collectstatic --noinput
|
poetry run python manage.py collectstatic --noinput
|
||||||
if [ "$PRODUCTION" == "False" ]; then
|
if [ "$PRODUCTION" == "False" ]; then
|
||||||
if [ "$AUTO_BACKEND" == "True" ]; then
|
|
||||||
poetry run python manage.py runserver 0.0.0.0:$BACKEND_INTERNAL_PORT
|
poetry run python manage.py runserver 0.0.0.0:$BACKEND_INTERNAL_PORT
|
||||||
else
|
|
||||||
exec tail -f /dev/null
|
|
||||||
# &
|
# &
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,746 +0,0 @@
|
|||||||
import { withMermaid } from 'vitepress-plugin-mermaid';
|
|
||||||
|
|
||||||
export default withMermaid({
|
|
||||||
themeConfig: {
|
|
||||||
search: {
|
|
||||||
provider: 'local'
|
|
||||||
},
|
|
||||||
sidebar: [
|
|
||||||
{
|
|
||||||
text: 'Структура',
|
|
||||||
collapsed: false,
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
"text": "App",
|
|
||||||
"link": "/src/App"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "components",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "CountDown",
|
|
||||||
"link": "/src/components/CountDown"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "UI",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "Auth-form",
|
|
||||||
"link": "/src/components/UI/Auth-form"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "NewsCard",
|
|
||||||
"link": "/src/components/UI/NewsCard"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "PatternTabs",
|
|
||||||
"link": "/src/components/UI/PatternTabs"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "SearcEmployess",
|
|
||||||
"link": "/src/components/UI/SearcEmployess"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Timer",
|
|
||||||
"link": "/src/components/UI/Timer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "aboutportal",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "card-feedback",
|
|
||||||
"link": "/src/components/UI/aboutportal/card-feedback"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "card-top-comment",
|
|
||||||
"link": "/src/components/UI/aboutportal/card-top-comment"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "card-total",
|
|
||||||
"link": "/src/components/UI/aboutportal/card-total"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "card_top_comment",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "card-comment",
|
|
||||||
"link": "/src/components/UI/aboutportal/card_top_comment/card-comment"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "feedmodul",
|
|
||||||
"link": "/src/components/UI/aboutportal/feedmodul"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "line-chart",
|
|
||||||
"link": "/src/components/UI/aboutportal/line-chart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "pattern-card-feed",
|
|
||||||
"link": "/src/components/UI/aboutportal/pattern-card-feed"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "pattern-card",
|
|
||||||
"link": "/src/components/UI/aboutportal/pattern-card"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "portal-traffic",
|
|
||||||
"link": "/src/components/UI/aboutportal/portal-traffic"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "rating-page",
|
|
||||||
"link": "/src/components/UI/aboutportal/rating-page"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "toolbar-filter",
|
|
||||||
"link": "/src/components/UI/aboutportal/toolbar-filter"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "tooltip-ico",
|
|
||||||
"link": "/src/components/UI/aboutportal/tooltip-ico"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "tooltip-user",
|
|
||||||
"link": "/src/components/UI/aboutportal/tooltip-user"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "top-user",
|
|
||||||
"link": "/src/components/UI/aboutportal/top-user"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "date-select",
|
|
||||||
"link": "/src/components/UI/date-select"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "defaultportal",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "page-counter",
|
|
||||||
"link": "/src/components/UI/defaultportal/page-counter"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "uploading-file",
|
|
||||||
"link": "/src/components/UI/defaultportal/uploading-file"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "feedback",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "feedstar-like",
|
|
||||||
"link": "/src/components/UI/feedback/feedstar-like"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "statistik-like",
|
|
||||||
"link": "/src/components/UI/feedback/statistik-like"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "fiousercard",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "icoUser",
|
|
||||||
"link": "/src/components/UI/fiousercard/icoUser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "infoUserCard",
|
|
||||||
"link": "/src/components/UI/fiousercard/infoUserCard"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "listUser",
|
|
||||||
"link": "/src/components/UI/fiousercard/listUser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "onlineUsers",
|
|
||||||
"link": "/src/components/UI/fiousercard/onlineUsers"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "vcardUser",
|
|
||||||
"link": "/src/components/UI/fiousercard/vcardUser"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "index",
|
|
||||||
"link": "/src/components/UI/index"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "my-helper",
|
|
||||||
"link": "/src/components/UI/my-helper"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "tooltip-number",
|
|
||||||
"link": "/src/components/UI/tooltip-number"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "tooltip-text",
|
|
||||||
"link": "/src/components/UI/tooltip-text"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "about_inspection",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "contacts",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "ContactInfo",
|
|
||||||
"link": "/src/components/about_inspection/contacts/ContactInfo"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "general_information",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "GeneralInformation",
|
|
||||||
"link": "/src/components/about_inspection/general_information/GeneralInformation"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "GeneralInformationSize",
|
|
||||||
"link": "/src/components/about_inspection/general_information/GeneralInformationSize"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "open_vacancies",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "OpenVacancies",
|
|
||||||
"link": "/src/components/about_inspection/open_vacancies/OpenVacancies"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "ResponseVacancies",
|
|
||||||
"link": "/src/components/about_inspection/open_vacancies/ResponseVacancies"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "structure",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "StructureInspection",
|
|
||||||
"link": "/src/components/about_inspection/structure/StructureInspection"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "StructureInspectionRow",
|
|
||||||
"link": "/src/components/about_inspection/structure/StructureInspectionRow"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "calendar_of_events",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "BigCalendar",
|
|
||||||
"link": "/src/components/calendar_of_events/BigCalendar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "UI_calendar",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "calendarFull",
|
|
||||||
"link": "/src/components/calendar_of_events/UI_calendar/calendarFull"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "dialogCreate",
|
|
||||||
"link": "/src/components/calendar_of_events/UI_calendar/dialogCreate"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "periodEvents",
|
|
||||||
"link": "/src/components/calendar_of_events/UI_calendar/periodEvents"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "reminderEvent",
|
|
||||||
"link": "/src/components/calendar_of_events/UI_calendar/reminderEvent"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "timeSelect",
|
|
||||||
"link": "/src/components/calendar_of_events/UI_calendar/timeSelect"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "calendar-create-select",
|
|
||||||
"link": "/src/components/calendar_of_events/calendar-create-select"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "calendar-create",
|
|
||||||
"link": "/src/components/calendar_of_events/calendar-create"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "calendar-my",
|
|
||||||
"link": "/src/components/calendar_of_events/calendar-my"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "event-calendar",
|
|
||||||
"link": "/src/components/calendar_of_events/event-calendar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "event-create",
|
|
||||||
"link": "/src/components/calendar_of_events/event-create"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "event-dialog-edit-participant",
|
|
||||||
"link": "/src/components/calendar_of_events/event-dialog-edit-participant"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "event-dialog-edit",
|
|
||||||
"link": "/src/components/calendar_of_events/event-dialog-edit"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "event-dialog-info",
|
|
||||||
"link": "/src/components/calendar_of_events/event-dialog-info"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "event-dialog",
|
|
||||||
"link": "/src/components/calendar_of_events/event-dialog"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "load-ical",
|
|
||||||
"link": "/src/components/calendar_of_events/load-ical"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "load-ical1",
|
|
||||||
"link": "/src/components/calendar_of_events/load-ical1"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "cardLike",
|
|
||||||
"link": "/src/components/cardLike"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "carousel-list",
|
|
||||||
"link": "/src/components/carousel-list"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "carousel-numbers",
|
|
||||||
"link": "/src/components/carousel-numbers"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "dialog-search",
|
|
||||||
"link": "/src/components/dialog-search"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "digital-letna",
|
|
||||||
"link": "/src/components/digital-letna"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "graph",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "chartConfig",
|
|
||||||
"link": "/src/components/graph/chartConfig"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "line-graph",
|
|
||||||
"link": "/src/components/graph/line-graph"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "load-round",
|
|
||||||
"link": "/src/components/load-round"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "news-crossroad",
|
|
||||||
"link": "/src/components/news-crossroad"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "news-full",
|
|
||||||
"link": "/src/components/news-full"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "news-home",
|
|
||||||
"link": "/src/components/news-home"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "secret",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "SmallTimer",
|
|
||||||
"link": "/src/components/secret/SmallTimer"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "testing",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "BodyDetailTesting",
|
|
||||||
"link": "/src/components/testing/BodyDetailTesting"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "CatalogTest",
|
|
||||||
"link": "/src/components/testing/CatalogTest"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "DetailCardTest",
|
|
||||||
"link": "/src/components/testing/DetailCardTest"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "HeaderDetailTesting",
|
|
||||||
"link": "/src/components/testing/HeaderDetailTesting"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "QuestionBlock",
|
|
||||||
"link": "/src/components/testing/QuestionBlock"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "TestResults",
|
|
||||||
"link": "/src/components/testing/TestResults"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "vote",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "ConstructorVote",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "AnswerList",
|
|
||||||
"link": "/src/components/vote/ConstructorVote/AnswerList"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "CreatedVote",
|
|
||||||
"link": "/src/components/vote/ConstructorVote/CreatedVote"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "MainInfo",
|
|
||||||
"link": "/src/components/vote/ConstructorVote/MainInfo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "NewQuestion",
|
|
||||||
"link": "/src/components/vote/ConstructorVote/NewQuestion"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "QuestionHeader",
|
|
||||||
"link": "/src/components/vote/ConstructorVote/QuestionHeader"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "QuestionItem",
|
|
||||||
"link": "/src/components/vote/ConstructorVote/QuestionItem"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "QuestionSettings",
|
|
||||||
"link": "/src/components/vote/ConstructorVote/QuestionSettings"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "CurrentVote",
|
|
||||||
"link": "/src/components/vote/CurrentVote"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "NonVoteHappy",
|
|
||||||
"link": "/src/components/vote/NonVoteHappy"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "NonVoteSad",
|
|
||||||
"link": "/src/components/vote/NonVoteSad"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "NoneVote",
|
|
||||||
"link": "/src/components/vote/NoneVote"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "VoteAdmin",
|
|
||||||
"link": "/src/components/vote/VoteAdmin"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "VoteAnimation",
|
|
||||||
"link": "/src/components/vote/VoteAnimation"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "VoteCard",
|
|
||||||
"link": "/src/components/vote/VoteCard"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "VoteConstructor",
|
|
||||||
"link": "/src/components/vote/VoteConstructor"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "VoteForm",
|
|
||||||
"link": "/src/components/vote/VoteForm"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "VoteResult",
|
|
||||||
"link": "/src/components/vote/VoteResult"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "layouts",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "default",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "AdminMenu",
|
|
||||||
"link": "/src/layouts/default/AdminMenu"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "DefaultPortal",
|
|
||||||
"link": "/src/layouts/default/DefaultPortal"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "alertDefault",
|
|
||||||
"link": "/src/layouts/default/alertDefault"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "main",
|
|
||||||
"link": "/src/main"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "plugins",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "index",
|
|
||||||
"link": "/src/plugins/index"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "vuetify",
|
|
||||||
"link": "/src/plugins/vuetify"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "webfontloader",
|
|
||||||
"link": "/src/plugins/webfontloader"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "router",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "index",
|
|
||||||
"link": "/src/router/index"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "store",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "AboutPortalFilter",
|
|
||||||
"link": "/src/store/AboutPortalFilter"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "AccountStore",
|
|
||||||
"link": "/src/store/AccountStore"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "MainmenuStore",
|
|
||||||
"link": "/src/store/MainmenuStore"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "WeekendsStore",
|
|
||||||
"link": "/src/store/WeekendsStore"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "app",
|
|
||||||
"link": "/src/store/app"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "index",
|
|
||||||
"link": "/src/store/index"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "seAlertStore",
|
|
||||||
"link": "/src/store/UseAlertStore"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "tests",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "App.test",
|
|
||||||
"link": "/src/tests/App.test"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "CarouselList.test",
|
|
||||||
"link": "/src/tests/CarouselList.test"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "utils",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "axios-api",
|
|
||||||
"link": "/src/utils/axios-api"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "universal_functions",
|
|
||||||
"link": "/src/utils/universal_functions"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "views",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "AboutInspectionPage",
|
|
||||||
"link": "/src/views/AboutInspectionPage"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "AboutPortalPage",
|
|
||||||
"link": "/src/views/AboutPortalPage"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "FAQPage",
|
|
||||||
"link": "/src/views/FAQPage"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "FeedbackPage",
|
|
||||||
"link": "/src/views/FeedbackPage"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "FnsHol",
|
|
||||||
"link": "/src/views/FnsHol"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "HomePage",
|
|
||||||
"link": "/src/views/HomePage"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "LaborProtection",
|
|
||||||
"link": "/src/views/LaborProtection"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "NewsPage",
|
|
||||||
"link": "/src/views/NewsPage"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "ProvidingActivitiesPage",
|
|
||||||
"link": "/src/views/ProvidingActivitiesPage"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "SecurityPage",
|
|
||||||
"link": "/src/views/SecurityPage"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "StructurePage",
|
|
||||||
"link": "/src/views/StructurePage"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "TestHomePage",
|
|
||||||
"link": "/src/views/TestHomePage"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Vote",
|
|
||||||
"link": "/src/views/Vote"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "VoteHomePage",
|
|
||||||
"link": "/src/views/VoteHomePage"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "nested_view",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "o_OKiB",
|
|
||||||
"link": "/src/views/nested_view/o_OKiB"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "safety",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "ChaptersSafety",
|
|
||||||
"link": "/src/views/safety/ChaptersSafety"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "DocumentationSafety",
|
|
||||||
"link": "/src/views/safety/DocumentationSafety"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "MainInfoSafety",
|
|
||||||
"link": "/src/views/safety/MainInfoSafety"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "TestSafety",
|
|
||||||
"link": "/src/views/safety/TestSafety"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "secret",
|
|
||||||
"collapsed": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"text": "SecretPage",
|
|
||||||
"link": "/src/views/secret/SecretPage"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: 'Гайды',
|
|
||||||
collapsed: true,
|
|
||||||
items: [
|
|
||||||
{ text: 'Как установить', link: '/guides/install' },
|
|
||||||
{ text: 'Как использовать', link: '/guides/usage' },
|
|
||||||
{ text: 'Правила комитов', link: '/guides/commits' }
|
|
||||||
,
|
|
||||||
{ text: 'Тесты', link: '/tests' },
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
mermaid: {
|
|
||||||
// refer https://mermaid.js.org/config/setup/modules/mermaidAPI.html#mermaidapi-configuration-defaults for options
|
|
||||||
},
|
|
||||||
// optionally set additional config for plugin itself with MermaidPluginConfig
|
|
||||||
mermaidPlugin: {
|
|
||||||
class: 'mermaid my-class', // set additional css classes for parent container
|
|
||||||
},});
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# CatalogTest
|
|
||||||
|
|
||||||
### Карточка где буду отрисовываться тесты в цикле
|
|
||||||
|
|
||||||
## Описание пропсов
|
|
||||||
|
|
||||||
| Пропс | Тип | Значение по умолчанию | Комментарий |
|
|
||||||
|-------|-----|-----------------------|-------------|
|
|
||||||
| `title` | `String` | `'Не забыть передать тайтл сюда!'` | нет комментария |
|
|
||||||
| `activeTab` | `Number` | `0` | нет комментария |
|
|
||||||
| `testingCard` | `Array` | `() => []` | нет комментария |
|
|
||||||
|
|
||||||
|
|
||||||
## Пример использования
|
|
||||||
|
|
||||||
```vue
|
|
||||||
import CatalogTest from '@/components/components/testing/CatalogTest';
|
|
||||||
```
|
|
||||||
|
|
||||||
```vue
|
|
||||||
<CatalogTest />
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
> Документация сгенерирована автоматически.
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# VoteConstructor
|
|
||||||
|
|
||||||
### Основная информация
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Пример использования
|
|
||||||
|
|
||||||
```vue
|
|
||||||
import VoteConstructor from '@/components/components/vote/VoteConstructor';
|
|
||||||
```
|
|
||||||
|
|
||||||
```vue
|
|
||||||
<VoteConstructor />
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
> Документация сгенерирована автоматически.
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
// rootDir: '../',
|
|
||||||
testEnvironment: 'jest-environment-jsdom',
|
|
||||||
roots: ['/app/src/front/src'],
|
|
||||||
setupFilesAfterEnv: ['/app/documentation/jest.setup.js'],
|
|
||||||
transform: {
|
|
||||||
'^.+\\.vue$': '@vue/vue3-jest',
|
|
||||||
'^.+\\.mjs$': 'babel-jest',
|
|
||||||
'^.+\\.js$': 'babel-jest',
|
|
||||||
'\\.(png|jpe?g|gif|svg)$': 'jest-transform-stub',
|
|
||||||
},
|
|
||||||
moduleFileExtensions: ['js', 'json', 'vue', 'mjs'],
|
|
||||||
moduleNameMapper: {
|
|
||||||
'^@/(.*)$': '/app/src/front/src/$1',
|
|
||||||
},
|
|
||||||
transformIgnorePatterns: ['/node_modules/(?!(vuetify|quasar)/)'],
|
|
||||||
collectCoverage: true,
|
|
||||||
collectCoverageFrom: ['/app/src/front/src/**/*.{js,vue}'],
|
|
||||||
coveragePathIgnorePatterns: ['/documentation/'],
|
|
||||||
coverageReporters: ['json', 'html'],
|
|
||||||
coverageDirectory: '/app/documentation/docs/public/test-coverage',
|
|
||||||
};
|
|
||||||
Generated
+1990
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"release-it": "^20.2.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
+630
-5
@@ -1,12 +1,637 @@
|
|||||||
[MASTER]
|
[MASTER]
|
||||||
load-plugins=pylint_django
|
load-plugins=pylint_django
|
||||||
ignore-paths=.*/migrations/*
|
ignore-paths=.*/migrations/*, .*/models.py
|
||||||
init-hook='import sys; sys.path.append("/back/"); import os; os.environ["DJANGO_SETTINGS_MODULE"] = "portal.settings"; import django; django.setup()'
|
init-hook='import sys; sys.path.append("/back/"); import os; os.environ["DJANGO_SETTINGS_MODULE"] = "portal.settings"; import django; django.setup()'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Analyse import fallback blocks. This can be used to support both Python 2 and
|
||||||
|
# 3 compatible code, which means that the block might have code that exists
|
||||||
|
# only in one or another interpreter, leading to false positives when analysed.
|
||||||
|
analyse-fallback-blocks=no
|
||||||
|
|
||||||
|
# Clear in-memory caches upon conclusion of linting. Useful if running pylint
|
||||||
|
# in a server-like mode.
|
||||||
|
clear-cache-post-run=no
|
||||||
|
|
||||||
|
# Load and enable all available extensions. Use --list-extensions to see a list
|
||||||
|
# all available extensions.
|
||||||
|
#enable-all-extensions=
|
||||||
|
|
||||||
|
# In error mode, messages with a category besides ERROR or FATAL are
|
||||||
|
# suppressed, and no reports are done by default. Error mode is compatible with
|
||||||
|
# disabling specific errors.
|
||||||
|
#errors-only=
|
||||||
|
|
||||||
|
# Always return a 0 (non-error) status code, even if lint errors are found.
|
||||||
|
# This is primarily useful in continuous integration scripts.
|
||||||
|
#exit-zero=
|
||||||
|
|
||||||
|
# A comma-separated list of package or module names from where C extensions may
|
||||||
|
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||||
|
# run arbitrary code.
|
||||||
|
extension-pkg-allow-list=
|
||||||
|
|
||||||
|
# A comma-separated list of package or module names from where C extensions may
|
||||||
|
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||||
|
# run arbitrary code. (This is an alternative name to extension-pkg-allow-list
|
||||||
|
# for backward compatibility.)
|
||||||
|
extension-pkg-whitelist=
|
||||||
|
|
||||||
|
# Return non-zero exit code if any of these messages/categories are detected,
|
||||||
|
# even if score is above --fail-under value. Syntax same as enable. Messages
|
||||||
|
# specified are enabled, while categories only check already-enabled messages.
|
||||||
|
fail-on=
|
||||||
|
|
||||||
|
# Specify a score threshold under which the program will exit with error.
|
||||||
|
fail-under=10
|
||||||
|
|
||||||
|
# Interpret the stdin as a python script, whose filename needs to be passed as
|
||||||
|
# the module_or_package argument.
|
||||||
|
#from-stdin=
|
||||||
|
|
||||||
|
# Files or directories to be skipped. They should be base names, not paths.
|
||||||
|
ignore=CVS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Files or directories matching the regular expression patterns are skipped.
|
||||||
|
# The regex matches against base names, not paths. The default value ignores
|
||||||
|
# Emacs file locks
|
||||||
|
ignore-patterns=^\.#
|
||||||
|
|
||||||
|
# List of module names for which member attributes should not be checked and
|
||||||
|
# will not be imported (useful for modules/projects where namespaces are
|
||||||
|
# manipulated during runtime and thus existing member attributes cannot be
|
||||||
|
# deduced by static analysis). It supports qualified module names, as well as
|
||||||
|
# Unix pattern matching.
|
||||||
|
ignored-modules=
|
||||||
|
|
||||||
|
# Python code to execute, usually for sys.path manipulation such as
|
||||||
|
# pygtk.require().
|
||||||
|
#init-hook=
|
||||||
|
|
||||||
|
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
|
||||||
|
# number of processors available to use, and will cap the count on Windows to
|
||||||
|
# avoid hangs.
|
||||||
|
jobs=1
|
||||||
|
|
||||||
|
# Control the amount of potential inferred values when inferring a single
|
||||||
|
# object. This can help the performance when dealing with large functions or
|
||||||
|
# complex, nested conditions.
|
||||||
|
limit-inference-results=100
|
||||||
|
|
||||||
|
|
||||||
|
# Pickle collected data for later comparisons.
|
||||||
|
persistent=yes
|
||||||
|
|
||||||
|
# Resolve imports to .pyi stubs if available. May reduce no-member messages and
|
||||||
|
# increase not-an-iterable messages.
|
||||||
|
prefer-stubs=no
|
||||||
|
|
||||||
|
# Minimum Python version to use for version dependent checks. Will default to
|
||||||
|
# the version used to run pylint.
|
||||||
|
py-version=3.13
|
||||||
|
|
||||||
|
# Discover python modules and packages in the file system subtree.
|
||||||
|
recursive=no
|
||||||
|
|
||||||
|
# Add paths to the list of the source roots. Supports globbing patterns. The
|
||||||
|
# source root is an absolute path or a path relative to the current working
|
||||||
|
# directory used to determine a package namespace for modules located under the
|
||||||
|
# source root.
|
||||||
|
source-roots=
|
||||||
|
|
||||||
|
# When enabled, pylint would attempt to guess common misconfiguration and emit
|
||||||
|
# user-friendly hints instead of false-positive error messages.
|
||||||
|
suggestion-mode=yes
|
||||||
|
|
||||||
|
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
||||||
|
# active Python interpreter and may run arbitrary code.
|
||||||
|
unsafe-load-any-extension=no
|
||||||
|
|
||||||
|
# In verbose mode, extra non-checker-related info will be displayed.
|
||||||
|
#verbose=
|
||||||
|
|
||||||
|
|
||||||
|
[BASIC]
|
||||||
|
|
||||||
|
# Naming style matching correct argument names.
|
||||||
|
argument-naming-style=snake_case
|
||||||
|
|
||||||
|
# Regular expression matching correct argument names. Overrides argument-
|
||||||
|
# naming-style. If left empty, argument names will be checked with the set
|
||||||
|
# naming style.
|
||||||
|
#argument-rgx=
|
||||||
|
|
||||||
|
# Naming style matching correct attribute names.
|
||||||
|
attr-naming-style=snake_case
|
||||||
|
|
||||||
|
# Regular expression matching correct attribute names. Overrides attr-naming-
|
||||||
|
# style. If left empty, attribute names will be checked with the set naming
|
||||||
|
# style.
|
||||||
|
#attr-rgx=
|
||||||
|
|
||||||
|
# Bad variable names which should always be refused, separated by a comma.
|
||||||
|
bad-names=foo,
|
||||||
|
bar,
|
||||||
|
baz,
|
||||||
|
toto,
|
||||||
|
tutu,
|
||||||
|
tata
|
||||||
|
|
||||||
|
# Bad variable names regexes, separated by a comma. If names match any regex,
|
||||||
|
# they will always be refused
|
||||||
|
bad-names-rgxs=
|
||||||
|
|
||||||
|
# Naming style matching correct class attribute names.
|
||||||
|
class-attribute-naming-style=any
|
||||||
|
|
||||||
|
# Regular expression matching correct class attribute names. Overrides class-
|
||||||
|
# attribute-naming-style. If left empty, class attribute names will be checked
|
||||||
|
# with the set naming style.
|
||||||
|
#class-attribute-rgx=
|
||||||
|
|
||||||
|
# Naming style matching correct class constant names.
|
||||||
|
class-const-naming-style=UPPER_CASE
|
||||||
|
|
||||||
|
# Regular expression matching correct class constant names. Overrides class-
|
||||||
|
# const-naming-style. If left empty, class constant names will be checked with
|
||||||
|
# the set naming style.
|
||||||
|
#class-const-rgx=
|
||||||
|
|
||||||
|
# Naming style matching correct class names.
|
||||||
|
class-naming-style=PascalCase
|
||||||
|
|
||||||
|
# Regular expression matching correct class names. Overrides class-naming-
|
||||||
|
# style. If left empty, class names will be checked with the set naming style.
|
||||||
|
#class-rgx=
|
||||||
|
|
||||||
|
# Naming style matching correct constant names.
|
||||||
|
const-naming-style=UPPER_CASE
|
||||||
|
|
||||||
|
# Regular expression matching correct constant names. Overrides const-naming-
|
||||||
|
# style. If left empty, constant names will be checked with the set naming
|
||||||
|
# style.
|
||||||
|
#const-rgx=
|
||||||
|
|
||||||
|
# Minimum line length for functions/classes that require docstrings, shorter
|
||||||
|
# ones are exempt.
|
||||||
|
docstring-min-length=-1
|
||||||
|
|
||||||
|
# Naming style matching correct function names.
|
||||||
|
function-naming-style=snake_case
|
||||||
|
|
||||||
|
# Regular expression matching correct function names. Overrides function-
|
||||||
|
# naming-style. If left empty, function names will be checked with the set
|
||||||
|
# naming style.
|
||||||
|
#function-rgx=
|
||||||
|
|
||||||
|
# Good variable names which should always be accepted, separated by a comma.
|
||||||
|
good-names=i,
|
||||||
|
j,
|
||||||
|
k,
|
||||||
|
ex,
|
||||||
|
Run,
|
||||||
|
_
|
||||||
|
|
||||||
|
# Good variable names regexes, separated by a comma. If names match any regex,
|
||||||
|
# they will always be accepted
|
||||||
|
good-names-rgxs=
|
||||||
|
|
||||||
|
# Include a hint for the correct naming format with invalid-name.
|
||||||
|
include-naming-hint=no
|
||||||
|
|
||||||
|
# Naming style matching correct inline iteration names.
|
||||||
|
inlinevar-naming-style=any
|
||||||
|
|
||||||
|
# Regular expression matching correct inline iteration names. Overrides
|
||||||
|
# inlinevar-naming-style. If left empty, inline iteration names will be checked
|
||||||
|
# with the set naming style.
|
||||||
|
#inlinevar-rgx=
|
||||||
|
|
||||||
|
# Naming style matching correct method names.
|
||||||
|
method-naming-style=snake_case
|
||||||
|
|
||||||
|
# Regular expression matching correct method names. Overrides method-naming-
|
||||||
|
# style. If left empty, method names will be checked with the set naming style.
|
||||||
|
#method-rgx=
|
||||||
|
|
||||||
|
# Naming style matching correct module names.
|
||||||
|
module-naming-style=snake_case
|
||||||
|
|
||||||
|
# Regular expression matching correct module names. Overrides module-naming-
|
||||||
|
# style. If left empty, module names will be checked with the set naming style.
|
||||||
|
#module-rgx=
|
||||||
|
|
||||||
|
# Colon-delimited sets of names that determine each other's naming style when
|
||||||
|
# the name regexes allow several styles.
|
||||||
|
name-group=
|
||||||
|
|
||||||
|
# Regular expression which should only match function or class names that do
|
||||||
|
# not require a docstring.
|
||||||
|
no-docstring-rgx=^_
|
||||||
|
|
||||||
|
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
||||||
|
# to this list to register other decorators that produce valid properties.
|
||||||
|
# These decorators are taken in consideration only for invalid-name.
|
||||||
|
property-classes=abc.abstractproperty
|
||||||
|
|
||||||
|
# Regular expression matching correct type alias names. If left empty, type
|
||||||
|
# alias names will be checked with the set naming style.
|
||||||
|
#typealias-rgx=
|
||||||
|
|
||||||
|
# Regular expression matching correct type variable names. If left empty, type
|
||||||
|
# variable names will be checked with the set naming style.
|
||||||
|
#typevar-rgx=
|
||||||
|
|
||||||
|
# Naming style matching correct variable names.
|
||||||
|
variable-naming-style=snake_case
|
||||||
|
|
||||||
|
# Regular expression matching correct variable names. Overrides variable-
|
||||||
|
# naming-style. If left empty, variable names will be checked with the set
|
||||||
|
# naming style.
|
||||||
|
#variable-rgx=
|
||||||
|
|
||||||
|
|
||||||
|
[CLASSES]
|
||||||
|
|
||||||
|
# Warn about protected attribute access inside special methods
|
||||||
|
check-protected-access-in-special-methods=no
|
||||||
|
|
||||||
|
# List of method names used to declare (i.e. assign) instance attributes.
|
||||||
|
defining-attr-methods=__init__,
|
||||||
|
__new__,
|
||||||
|
setUp,
|
||||||
|
asyncSetUp,
|
||||||
|
__post_init__
|
||||||
|
|
||||||
|
# List of member names, which should be excluded from the protected access
|
||||||
|
# warning.
|
||||||
|
exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit
|
||||||
|
|
||||||
|
# List of valid names for the first argument in a class method.
|
||||||
|
valid-classmethod-first-arg=cls
|
||||||
|
|
||||||
|
# List of valid names for the first argument in a metaclass class method.
|
||||||
|
valid-metaclass-classmethod-first-arg=mcs
|
||||||
|
|
||||||
|
|
||||||
|
[DESIGN]
|
||||||
|
|
||||||
|
# List of regular expressions of class ancestor names to ignore when counting
|
||||||
|
# public methods (see R0903)
|
||||||
|
exclude-too-few-public-methods=
|
||||||
|
|
||||||
|
# List of qualified class names to ignore when counting class parents (see
|
||||||
|
# R0901)
|
||||||
|
ignored-parents=
|
||||||
|
|
||||||
|
# Maximum number of arguments for function / method.
|
||||||
|
max-args=5
|
||||||
|
|
||||||
|
# Maximum number of attributes for a class (see R0902).
|
||||||
|
max-attributes=7
|
||||||
|
|
||||||
|
# Maximum number of boolean expressions in an if statement (see R0916).
|
||||||
|
max-bool-expr=5
|
||||||
|
|
||||||
|
# Maximum number of branch for function / method body.
|
||||||
|
max-branches=12
|
||||||
|
|
||||||
|
# Maximum number of locals for function / method body.
|
||||||
|
max-locals=15
|
||||||
|
|
||||||
|
# Maximum number of parents for a class (see R0901).
|
||||||
|
max-parents=7
|
||||||
|
|
||||||
|
# Maximum number of positional arguments for function / method.
|
||||||
|
max-positional-arguments=5
|
||||||
|
|
||||||
|
# Maximum number of public methods for a class (see R0904).
|
||||||
|
max-public-methods=20
|
||||||
|
|
||||||
|
# Maximum number of return / yield for function / method body.
|
||||||
|
max-returns=6
|
||||||
|
|
||||||
|
# Maximum number of statements in function / method body.
|
||||||
|
max-statements=50
|
||||||
|
|
||||||
|
# Minimum number of public methods for a class (see R0903).
|
||||||
|
min-public-methods=1
|
||||||
|
|
||||||
|
|
||||||
|
[EXCEPTIONS]
|
||||||
|
|
||||||
|
# Exceptions that will emit a warning when caught.
|
||||||
|
overgeneral-exceptions=builtins.BaseException,builtins.Exception
|
||||||
|
|
||||||
|
|
||||||
[FORMAT]
|
[FORMAT]
|
||||||
# Настройки форматирования
|
|
||||||
max-line-length=100
|
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
||||||
|
expected-line-ending-format=
|
||||||
|
|
||||||
|
# Regexp for a line that is allowed to be longer than the limit.
|
||||||
|
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
||||||
|
|
||||||
|
# Number of spaces of indent required inside a hanging or continued line.
|
||||||
|
indent-after-paren=4
|
||||||
|
|
||||||
|
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
||||||
|
# tab).
|
||||||
|
indent-string=' '
|
||||||
|
|
||||||
|
# Maximum number of characters on a single line.
|
||||||
|
max-line-length=130
|
||||||
|
|
||||||
|
# Maximum number of lines in a module.
|
||||||
|
max-module-lines=1000
|
||||||
|
|
||||||
|
# Allow the body of a class to be on the same line as the declaration if body
|
||||||
|
# contains single statement.
|
||||||
|
single-line-class-stmt=no
|
||||||
|
|
||||||
|
# Allow the body of an if to be on the same line as the test if there is no
|
||||||
|
# else.
|
||||||
|
single-line-if-stmt=no
|
||||||
|
|
||||||
|
|
||||||
|
[IMPORTS]
|
||||||
|
|
||||||
|
# List of modules that can be imported at any level, not just the top level
|
||||||
|
# one.
|
||||||
|
allow-any-import-level=
|
||||||
|
|
||||||
|
# Allow explicit reexports by alias from a package __init__.
|
||||||
|
allow-reexport-from-package=no
|
||||||
|
|
||||||
|
# Allow wildcard imports from modules that define __all__.
|
||||||
|
allow-wildcard-with-all=no
|
||||||
|
|
||||||
|
# Deprecated modules which should not be used, separated by a comma.
|
||||||
|
deprecated-modules=
|
||||||
|
|
||||||
|
# Output a graph (.gv or any supported image format) of external dependencies
|
||||||
|
# to the given file (report RP0402 must not be disabled).
|
||||||
|
ext-import-graph=
|
||||||
|
|
||||||
|
# Output a graph (.gv or any supported image format) of all (i.e. internal and
|
||||||
|
# external) dependencies to the given file (report RP0402 must not be
|
||||||
|
# disabled).
|
||||||
|
import-graph=
|
||||||
|
|
||||||
|
# Output a graph (.gv or any supported image format) of internal dependencies
|
||||||
|
# to the given file (report RP0402 must not be disabled).
|
||||||
|
int-import-graph=
|
||||||
|
|
||||||
|
# Force import order to recognize a module as part of the standard
|
||||||
|
# compatibility libraries.
|
||||||
|
known-standard-library=
|
||||||
|
|
||||||
|
# Force import order to recognize a module as part of a third party library.
|
||||||
|
known-third-party=enchant
|
||||||
|
|
||||||
|
# Couples of modules and preferred modules, separated by a comma.
|
||||||
|
preferred-modules=
|
||||||
|
|
||||||
|
|
||||||
|
[LOGGING]
|
||||||
|
|
||||||
|
# The type of string formatting that logging methods do. `old` means using %
|
||||||
|
# formatting, `new` is for `{}` formatting.
|
||||||
|
logging-format-style=old
|
||||||
|
|
||||||
|
# Logging modules to check that the string format arguments are in logging
|
||||||
|
# function parameter format.
|
||||||
|
logging-modules=logging
|
||||||
|
|
||||||
|
|
||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
# Отключение определенных сообщений
|
disable=C0114,W0223
|
||||||
disable=C0114 # Missing module docstring
|
|
||||||
|
# Only show warnings with the listed confidence levels. Leave empty to show
|
||||||
|
# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
|
||||||
|
# UNDEFINED.
|
||||||
|
confidence=HIGH,
|
||||||
|
CONTROL_FLOW,
|
||||||
|
INFERENCE,
|
||||||
|
INFERENCE_FAILURE,
|
||||||
|
UNDEFINED
|
||||||
|
|
||||||
|
# Disable the message, report, category or checker with the given id(s). You
|
||||||
|
# can either give multiple identifiers separated by comma (,) or put this
|
||||||
|
# option multiple times (only on the command line, not in the configuration
|
||||||
|
# file where it should appear only once). You can also use "--disable=all" to
|
||||||
|
# disable everything first and then re-enable specific checks. For example, if
|
||||||
|
# you want to run only the similarities checker, you can use "--disable=all
|
||||||
|
# --enable=similarities". If you want to run only the classes checker, but have
|
||||||
|
# no Warning level messages displayed, use "--disable=all --enable=classes
|
||||||
|
# --disable=W".
|
||||||
|
|
||||||
|
|
||||||
|
# Enable the message, report, category or checker with the given id(s). You can
|
||||||
|
# either give multiple identifier separated by comma (,) or put this option
|
||||||
|
# multiple time (only on the command line, not in the configuration file where
|
||||||
|
# it should appear only once). See also the "--disable" option for examples.
|
||||||
|
enable=
|
||||||
|
|
||||||
|
|
||||||
|
[METHOD_ARGS]
|
||||||
|
|
||||||
|
# List of qualified names (i.e., library.method) which require a timeout
|
||||||
|
# parameter e.g. 'requests.api.get,requests.api.post'
|
||||||
|
timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request
|
||||||
|
|
||||||
|
|
||||||
|
[MISCELLANEOUS]
|
||||||
|
|
||||||
|
# List of note tags to take in consideration, separated by a comma.
|
||||||
|
notes=FIXME,
|
||||||
|
XXX,
|
||||||
|
TODO
|
||||||
|
|
||||||
|
# Regular expression of note tags to take in consideration.
|
||||||
|
notes-rgx=
|
||||||
|
|
||||||
|
|
||||||
|
[REFACTORING]
|
||||||
|
|
||||||
|
# Maximum number of nested blocks for function / method body
|
||||||
|
max-nested-blocks=5
|
||||||
|
|
||||||
|
# Complete name of functions that never returns. When checking for
|
||||||
|
# inconsistent-return-statements if a never returning function is called then
|
||||||
|
# it will be considered as an explicit return statement and no message will be
|
||||||
|
# printed.
|
||||||
|
never-returning-functions=sys.exit,argparse.parse_error
|
||||||
|
|
||||||
|
# Let 'consider-using-join' be raised when the separator to join on would be
|
||||||
|
# non-empty (resulting in expected fixes of the type: ``"- " + " -
|
||||||
|
# ".join(items)``)
|
||||||
|
suggest-join-with-non-empty-separator=yes
|
||||||
|
|
||||||
|
|
||||||
|
[REPORTS]
|
||||||
|
|
||||||
|
# Python expression which should return a score less than or equal to 10. You
|
||||||
|
# have access to the variables 'fatal', 'error', 'warning', 'refactor',
|
||||||
|
# 'convention', and 'info' which contain the number of messages in each
|
||||||
|
# category, as well as 'statement' which is the total number of statements
|
||||||
|
# analyzed. This score is used by the global evaluation report (RP0004).
|
||||||
|
evaluation=max(0, 0 if fatal else 10.0 - ((float(10 * error + 5*warning + 3*refactor + 2*convention) / statement) * 10))
|
||||||
|
|
||||||
|
# Template used to display messages. This is a python new-style format string
|
||||||
|
# used to format the message information. See doc for all details.
|
||||||
|
msg-template=
|
||||||
|
|
||||||
|
# Set the output format. Available formats are: 'text', 'parseable',
|
||||||
|
# 'colorized', 'json2' (improved json format), 'json' (old json format), msvs
|
||||||
|
# (visual studio) and 'github' (GitHub actions). You can also give a reporter
|
||||||
|
# class, e.g. mypackage.mymodule.MyReporterClass.
|
||||||
|
output-format=colorized
|
||||||
|
|
||||||
|
# Tells whether to display a full report or only the messages.
|
||||||
|
reports=yes
|
||||||
|
|
||||||
|
# Activate the evaluation score.
|
||||||
|
score=yes
|
||||||
|
|
||||||
|
|
||||||
|
[SIMILARITIES]
|
||||||
|
|
||||||
|
# Comments are removed from the similarity computation
|
||||||
|
ignore-comments=yes
|
||||||
|
|
||||||
|
# Docstrings are removed from the similarity computation
|
||||||
|
ignore-docstrings=yes
|
||||||
|
|
||||||
|
# Imports are removed from the similarity computation
|
||||||
|
ignore-imports=yes
|
||||||
|
|
||||||
|
# Signatures are removed from the similarity computation
|
||||||
|
ignore-signatures=yes
|
||||||
|
|
||||||
|
# Minimum lines number of a similarity.
|
||||||
|
min-similarity-lines=4
|
||||||
|
|
||||||
|
|
||||||
|
[SPELLING]
|
||||||
|
|
||||||
|
# Limits count of emitted suggestions for spelling mistakes.
|
||||||
|
max-spelling-suggestions=4
|
||||||
|
|
||||||
|
# Spelling dictionary name. No available dictionaries : You need to install
|
||||||
|
# both the python package and the system dependency for enchant to work.
|
||||||
|
spelling-dict=
|
||||||
|
|
||||||
|
# List of comma separated words that should be considered directives if they
|
||||||
|
# appear at the beginning of a comment and should not be checked.
|
||||||
|
spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
|
||||||
|
|
||||||
|
# List of comma separated words that should not be checked.
|
||||||
|
spelling-ignore-words=
|
||||||
|
|
||||||
|
# A path to a file that contains the private dictionary; one word per line.
|
||||||
|
spelling-private-dict-file=
|
||||||
|
|
||||||
|
# Tells whether to store unknown words to the private dictionary (see the
|
||||||
|
# --spelling-private-dict-file option) instead of raising a message.
|
||||||
|
spelling-store-unknown-words=no
|
||||||
|
|
||||||
|
|
||||||
|
[STRING]
|
||||||
|
|
||||||
|
# This flag controls whether inconsistent-quotes generates a warning when the
|
||||||
|
# character used as a quote delimiter is used inconsistently within a module.
|
||||||
|
check-quote-consistency=no
|
||||||
|
|
||||||
|
# This flag controls whether the implicit-str-concat should generate a warning
|
||||||
|
# on implicit string concatenation in sequences defined over several lines.
|
||||||
|
check-str-concat-over-line-jumps=no
|
||||||
|
|
||||||
|
|
||||||
|
[TYPECHECK]
|
||||||
|
|
||||||
|
# List of decorators that produce context managers, such as
|
||||||
|
# contextlib.contextmanager. Add to this list to register other decorators that
|
||||||
|
# produce valid context managers.
|
||||||
|
contextmanager-decorators=contextlib.contextmanager
|
||||||
|
|
||||||
|
# List of members which are set dynamically and missed by pylint inference
|
||||||
|
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
||||||
|
# expressions are accepted.
|
||||||
|
generated-members=
|
||||||
|
|
||||||
|
# Tells whether to warn about missing members when the owner of the attribute
|
||||||
|
# is inferred to be None.
|
||||||
|
ignore-none=yes
|
||||||
|
|
||||||
|
# This flag controls whether pylint should warn about no-member and similar
|
||||||
|
# checks whenever an opaque object is returned when inferring. The inference
|
||||||
|
# can return multiple potential results while evaluating a Python object, but
|
||||||
|
# some branches might not be evaluated, which results in partial inference. In
|
||||||
|
# that case, it might be useful to still emit no-member and other checks for
|
||||||
|
# the rest of the inferred objects.
|
||||||
|
ignore-on-opaque-inference=yes
|
||||||
|
|
||||||
|
# List of symbolic message names to ignore for Mixin members.
|
||||||
|
ignored-checks-for-mixins=no-member,
|
||||||
|
not-async-context-manager,
|
||||||
|
not-context-manager,
|
||||||
|
attribute-defined-outside-init
|
||||||
|
|
||||||
|
# List of class names for which member attributes should not be checked (useful
|
||||||
|
# for classes with dynamically set attributes). This supports the use of
|
||||||
|
# qualified names.
|
||||||
|
ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace
|
||||||
|
|
||||||
|
# Show a hint with possible names when a member name was not found. The aspect
|
||||||
|
# of finding the hint is based on edit distance.
|
||||||
|
missing-member-hint=yes
|
||||||
|
|
||||||
|
# The maximum edit distance a name should have in order to be considered a
|
||||||
|
# similar match for a missing member name.
|
||||||
|
missing-member-hint-distance=1
|
||||||
|
|
||||||
|
# The total number of similar names that should be taken in consideration when
|
||||||
|
# showing a hint for a missing member.
|
||||||
|
missing-member-max-choices=1
|
||||||
|
|
||||||
|
# Regex pattern to define which classes are considered mixins.
|
||||||
|
mixin-class-rgx=.*[Mm]ixin
|
||||||
|
|
||||||
|
# List of decorators that change the signature of a decorated function.
|
||||||
|
signature-mutators=
|
||||||
|
|
||||||
|
|
||||||
|
[VARIABLES]
|
||||||
|
|
||||||
|
# List of additional names supposed to be defined in builtins. Remember that
|
||||||
|
# you should avoid defining new builtins when possible.
|
||||||
|
additional-builtins=
|
||||||
|
|
||||||
|
# Tells whether unused global variables should be treated as a violation.
|
||||||
|
allow-global-unused-variables=yes
|
||||||
|
|
||||||
|
# List of names allowed to shadow builtins
|
||||||
|
allowed-redefined-builtins=
|
||||||
|
|
||||||
|
# List of strings which can identify a callback function by name. A callback
|
||||||
|
# name must start or end with one of those strings.
|
||||||
|
callbacks=cb_,
|
||||||
|
_cb
|
||||||
|
|
||||||
|
# A regular expression matching the name of dummy variables (i.e. expected to
|
||||||
|
# not be used).
|
||||||
|
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
|
||||||
|
|
||||||
|
# Argument names that match this expression will be ignored.
|
||||||
|
ignored-argument-names=_.*|^ignored_|^unused_
|
||||||
|
|
||||||
|
# Tells whether we should check for unused import in __init__ files.
|
||||||
|
init-import=no
|
||||||
|
|
||||||
|
# List of qualified module names which can have objects that can redefine
|
||||||
|
# builtins.
|
||||||
|
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
|
||||||
Vendored
-22
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Python: Django (Docker)",
|
|
||||||
"type": "python",
|
|
||||||
"request": "launch",
|
|
||||||
"module": "manage",
|
|
||||||
"args": [
|
|
||||||
"runserver",
|
|
||||||
"0.0.0.0:8000"
|
|
||||||
],
|
|
||||||
"django": true,
|
|
||||||
"justMyCode": true,
|
|
||||||
"env": {
|
|
||||||
"PYTHONPATH": "${workspaceFolder}"
|
|
||||||
},
|
|
||||||
"console": "integratedTerminal",
|
|
||||||
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
+21
-13
@@ -1,36 +1,44 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import *
|
|
||||||
from userauth.models import DictDepartment
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
|
from userauth.models import DictDepartment
|
||||||
|
|
||||||
|
from .models import *
|
||||||
|
|
||||||
|
|
||||||
class InspectionDirectionsAdmin(admin.ModelAdmin):
|
class InspectionDirectionsAdmin(admin.ModelAdmin):
|
||||||
list_display=('direction_title',)
|
list_display = ("direction_title",)
|
||||||
fields=('direction_title','icon_name',)
|
fields = (
|
||||||
|
"direction_title",
|
||||||
|
"icon_name",
|
||||||
|
)
|
||||||
|
|
||||||
def get_form(self, request, obj=None, **kwargs):
|
def get_form(self, request, obj=None, **kwargs):
|
||||||
form = super().get_form(request, obj, **kwargs)
|
form = super().get_form(request, obj, **kwargs)
|
||||||
form.base_fields['direction_title'].label += " инспекции"
|
form.base_fields["direction_title"].label += " инспекции"
|
||||||
return form
|
return form
|
||||||
|
|
||||||
def get_queryset(self, request):
|
def get_queryset(self, request):
|
||||||
qs = super().get_queryset(request)
|
qs = super().get_queryset(request)
|
||||||
qs = qs.filter(department__isnull=True)
|
qs = qs.filter(department__isnull=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
|
|
||||||
class VacanciesAdmin(admin.ModelAdmin):
|
class VacanciesAdmin(admin.ModelAdmin):
|
||||||
def get_form(self, request, obj=None, **kwargs):
|
def get_form(self, request, obj=None, **kwargs):
|
||||||
form = super().get_form(request, obj, **kwargs)
|
form = super().get_form(request, obj, **kwargs)
|
||||||
form.base_fields['department'].queryset = DictDepartment.objects.filter(~Q(name="Все сотрудники"),deleted=0)
|
form.base_fields["department"].queryset = DictDepartment.objects.filter(~Q(name="Все сотрудники"), deleted=0)
|
||||||
return form
|
return form
|
||||||
|
|
||||||
class ResponseVacancyAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ('fio', 'cdate', 'email', 'tel', 'vacancy')
|
|
||||||
readonly_fields = ('fio', 'cdate', 'text', 'email', 'tel', 'file', 'vacancy')
|
|
||||||
list_filter = ('cdate', 'vacancy__department')
|
|
||||||
|
|
||||||
admin.site.register(Vacancies,VacanciesAdmin)
|
class ResponseVacancyAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("fio", "cdate", "email", "tel", "vacancy")
|
||||||
|
readonly_fields = ("fio", "cdate", "text", "email", "tel", "file", "vacancy")
|
||||||
|
list_filter = ("cdate", "vacancy__department")
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(Vacancies, VacanciesAdmin)
|
||||||
admin.site.register(StateSize)
|
admin.site.register(StateSize)
|
||||||
admin.site.register(FactSize)
|
admin.site.register(FactSize)
|
||||||
admin.site.register(InspectionDirections, InspectionDirectionsAdmin)
|
admin.site.register(InspectionDirections, InspectionDirectionsAdmin)
|
||||||
|
|||||||
Regular → Executable
+3
-3
@@ -2,6 +2,6 @@ from django.apps import AppConfig
|
|||||||
|
|
||||||
|
|
||||||
class AboutInspectionConfig(AppConfig):
|
class AboutInspectionConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
name = 'about_inspection'
|
name = "about_inspection"
|
||||||
verbose_name = 'Об инспекции'
|
verbose_name = "Об инспекции"
|
||||||
Regular → Executable
+81
-42
@@ -1,86 +1,125 @@
|
|||||||
# Generated by Django 4.2.3 on 2025-01-31 09:42
|
# Generated by Django 4.2.3 on 2025-01-31 09:42
|
||||||
|
|
||||||
import ckeditor_uploader.fields
|
import ckeditor_uploader.fields
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('userauth', '0001_initial'),
|
("userauth", "0001_initial"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='FactSize',
|
name="FactSize",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('factsize', models.IntegerField(verbose_name='Фактическая численность')),
|
("factsize", models.IntegerField(verbose_name="Фактическая численность")),
|
||||||
('date_created', models.DateField(verbose_name='Дата создания')),
|
("date_created", models.DateField(verbose_name="Дата создания")),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Фактическая численность',
|
"verbose_name": "Фактическая численность",
|
||||||
'verbose_name_plural': 'Фактическая численность',
|
"verbose_name_plural": "Фактическая численность",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='StateSize',
|
name="StateSize",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('statesize', models.IntegerField(verbose_name='Штатная численность')),
|
("statesize", models.IntegerField(verbose_name="Штатная численность")),
|
||||||
('date_created', models.DateField(verbose_name='Дата создания')),
|
("date_created", models.DateField(verbose_name="Дата создания")),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Штатная численность',
|
"verbose_name": "Штатная численность",
|
||||||
'verbose_name_plural': 'Штатная численность',
|
"verbose_name_plural": "Штатная численность",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Vacancies',
|
name="Vacancies",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('name', models.TextField(verbose_name='Наименование')),
|
("name", models.TextField(verbose_name="Наименование")),
|
||||||
('functional', ckeditor_uploader.fields.RichTextUploadingField(blank=True, null=True, verbose_name='Функционал и должностные обязанности')),
|
(
|
||||||
('requirements', ckeditor_uploader.fields.RichTextUploadingField(blank=True, null=True, verbose_name='Базовые требования к соискателю')),
|
"functional",
|
||||||
('published', models.BooleanField(default=False, verbose_name='Опубликована')),
|
ckeditor_uploader.fields.RichTextUploadingField(
|
||||||
('department', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='userauth.dictdepartment', verbose_name='Отдел')),
|
blank=True, null=True, verbose_name="Функционал и должностные обязанности"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"requirements",
|
||||||
|
ckeditor_uploader.fields.RichTextUploadingField(
|
||||||
|
blank=True, null=True, verbose_name="Базовые требования к соискателю"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("published", models.BooleanField(default=False, verbose_name="Опубликована")),
|
||||||
|
(
|
||||||
|
"department",
|
||||||
|
models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
|
to="userauth.dictdepartment",
|
||||||
|
verbose_name="Отдел",
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Вакансия ',
|
"verbose_name": "Вакансия ",
|
||||||
'verbose_name_plural': 'Вакансии',
|
"verbose_name_plural": "Вакансии",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='ResponseVacancy',
|
name="ResponseVacancy",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('fio', models.CharField(max_length=300, verbose_name='ФИО')),
|
("fio", models.CharField(max_length=300, verbose_name="ФИО")),
|
||||||
('cdate', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
|
("cdate", models.DateTimeField(auto_now_add=True, verbose_name="Дата создания")),
|
||||||
('text', models.TextField(null=True, verbose_name='Сообщение')),
|
("text", models.TextField(null=True, verbose_name="Сообщение")),
|
||||||
('email', models.CharField(max_length=300, null=True, verbose_name='Почта')),
|
("email", models.CharField(max_length=300, null=True, verbose_name="Почта")),
|
||||||
('tel', models.CharField(max_length=300, null=True, verbose_name='Номер телефона')),
|
("tel", models.CharField(max_length=300, null=True, verbose_name="Номер телефона")),
|
||||||
('file', models.FileField(null=True, upload_to='response/%Y/%m/%d', verbose_name='Файл резюме')),
|
("file", models.FileField(null=True, upload_to="response/%Y/%m/%d", verbose_name="Файл резюме")),
|
||||||
('vacancy', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='get_vacancies', to='about_inspection.vacancies', verbose_name='Вакансия')),
|
(
|
||||||
|
"vacancy",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
|
related_name="get_vacancies",
|
||||||
|
to="about_inspection.vacancies",
|
||||||
|
verbose_name="Вакансия",
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Отклик на вакансию',
|
"verbose_name": "Отклик на вакансию",
|
||||||
'verbose_name_plural': 'Отклики на вакансию',
|
"verbose_name_plural": "Отклики на вакансию",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='InspectionDirections',
|
name="InspectionDirections",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('direction_title', models.CharField(max_length=255, verbose_name='Направление деятельности')),
|
("direction_title", models.CharField(max_length=255, verbose_name="Направление деятельности")),
|
||||||
('icon_name', models.CharField(blank=True, default='mdi-sign-direction', max_length=100, verbose_name='Название иконки')),
|
(
|
||||||
('department', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='department_directions', to='userauth.dictdepartment', verbose_name='Отдел')),
|
"icon_name",
|
||||||
|
models.CharField(blank=True, default="mdi-sign-direction", max_length=100, verbose_name="Название иконки"),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"department",
|
||||||
|
models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
|
related_name="department_directions",
|
||||||
|
to="userauth.dictdepartment",
|
||||||
|
verbose_name="Отдел",
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Направление деятельности ',
|
"verbose_name": "Направление деятельности ",
|
||||||
'verbose_name_plural': 'Направления деятельности',
|
"verbose_name_plural": "Направления деятельности",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
+38
-19
@@ -1,24 +1,31 @@
|
|||||||
from django.db import models
|
|
||||||
from userauth.models import DictDepartment
|
|
||||||
from ckeditor_uploader.fields import RichTextUploadingField
|
from ckeditor_uploader.fields import RichTextUploadingField
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
from userauth.models import DictDepartment
|
||||||
|
|
||||||
|
|
||||||
# Модель Штатная численность
|
# Модель Штатная численность
|
||||||
class StateSize(models.Model):
|
class StateSize(models.Model):
|
||||||
statesize = models.IntegerField( verbose_name="Штатная численность")
|
statesize = models.IntegerField(verbose_name="Штатная численность")
|
||||||
date_created = models.DateField(verbose_name="Дата создания")
|
date_created = models.DateField(verbose_name="Дата создания")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Штатная численность"
|
verbose_name = "Штатная численность"
|
||||||
verbose_name_plural = "Штатная численность"
|
verbose_name_plural = "Штатная численность"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.statesize)
|
return str(self.statesize)
|
||||||
|
|
||||||
#Модель Фактическая численность
|
|
||||||
|
# Модель Фактическая численность
|
||||||
class FactSize(models.Model):
|
class FactSize(models.Model):
|
||||||
factsize = models.IntegerField( verbose_name="Фактическая численность")
|
factsize = models.IntegerField(verbose_name="Фактическая численность")
|
||||||
date_created = models.DateField(verbose_name="Дата создания")
|
date_created = models.DateField(verbose_name="Дата создания")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Фактическая численность"
|
verbose_name = "Фактическая численность"
|
||||||
verbose_name_plural = "Фактическая численность"
|
verbose_name_plural = "Фактическая численность"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.factsize)
|
return str(self.factsize)
|
||||||
|
|
||||||
@@ -26,40 +33,52 @@ class FactSize(models.Model):
|
|||||||
# Модель Направление деятельности инспекции
|
# Модель Направление деятельности инспекции
|
||||||
class InspectionDirections(models.Model):
|
class InspectionDirections(models.Model):
|
||||||
direction_title = models.CharField(max_length=255, verbose_name="Направление деятельности")
|
direction_title = models.CharField(max_length=255, verbose_name="Направление деятельности")
|
||||||
icon_name = models.CharField(max_length=100, verbose_name="Название иконки", default="mdi-sign-direction" ,blank=True)
|
icon_name = models.CharField(max_length=100, verbose_name="Название иконки", default="mdi-sign-direction", blank=True)
|
||||||
department = models.ForeignKey (DictDepartment,on_delete=models.PROTECT, null=True, blank=True, verbose_name='Отдел', related_name='department_directions')
|
department = models.ForeignKey(
|
||||||
|
DictDepartment,
|
||||||
|
on_delete=models.PROTECT,
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
verbose_name="Отдел",
|
||||||
|
related_name="department_directions",
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Направление деятельности "
|
verbose_name = "Направление деятельности "
|
||||||
verbose_name_plural = "Направления деятельности"
|
verbose_name_plural = "Направления деятельности"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.direction_title
|
return self.direction_title
|
||||||
|
|
||||||
|
|
||||||
class Vacancies(models.Model):
|
class Vacancies(models.Model):
|
||||||
name=models.TextField(verbose_name="Наименование")
|
name = models.TextField(verbose_name="Наименование")
|
||||||
department = models.ForeignKey (DictDepartment,on_delete=models.PROTECT, null=True, blank=True, verbose_name='Отдел')
|
department = models.ForeignKey(DictDepartment, on_delete=models.PROTECT, null=True, blank=True, verbose_name="Отдел")
|
||||||
functional = RichTextUploadingField(null=True, blank= True, verbose_name='Функционал и должностные обязанности')
|
functional = RichTextUploadingField(null=True, blank=True, verbose_name="Функционал и должностные обязанности")
|
||||||
requirements = RichTextUploadingField(null=True, blank= True, verbose_name='Базовые требования к соискателю')
|
requirements = RichTextUploadingField(null=True, blank=True, verbose_name="Базовые требования к соискателю")
|
||||||
published = models.BooleanField(default = False, verbose_name="Опубликована")
|
published = models.BooleanField(default=False, verbose_name="Опубликована")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Вакансия "
|
verbose_name = "Вакансия "
|
||||||
verbose_name_plural = "Вакансии"
|
verbose_name_plural = "Вакансии"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
# Отклик на вакансию
|
# Отклик на вакансию
|
||||||
class ResponseVacancy(models.Model):
|
class ResponseVacancy(models.Model):
|
||||||
fio = models.CharField(max_length=300, verbose_name='ФИО')
|
fio = models.CharField(max_length=300, verbose_name="ФИО")
|
||||||
cdate = models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')
|
cdate = models.DateTimeField(auto_now_add=True, verbose_name="Дата создания")
|
||||||
text = models.TextField(null=True, verbose_name='Сообщение')
|
text = models.TextField(null=True, verbose_name="Сообщение")
|
||||||
email = models.CharField(null=True,max_length=300, verbose_name='Почта')
|
email = models.CharField(null=True, max_length=300, verbose_name="Почта")
|
||||||
tel = models.CharField(null=True,max_length=300, verbose_name='Номер телефона')
|
tel = models.CharField(null=True, max_length=300, verbose_name="Номер телефона")
|
||||||
file = models.FileField(null=True, upload_to='response/%Y/%m/%d', verbose_name='Файл резюме')
|
file = models.FileField(null=True, upload_to="response/%Y/%m/%d", verbose_name="Файл резюме")
|
||||||
vacancy = models.ForeignKey(Vacancies, on_delete=models.PROTECT, related_name='get_vacancies', verbose_name='Вакансия')
|
vacancy = models.ForeignKey(Vacancies, on_delete=models.PROTECT, related_name="get_vacancies", verbose_name="Вакансия")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Отклик на вакансию"
|
verbose_name = "Отклик на вакансию"
|
||||||
verbose_name_plural = "Отклики на вакансию"
|
verbose_name_plural = "Отклики на вакансию"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.fio
|
return self.fio
|
||||||
Regular → Executable
+48
-37
@@ -1,28 +1,38 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from .models import *
|
|
||||||
from userauth.models import *
|
from userauth.models import *
|
||||||
from userauth.serializers import *
|
from userauth.serializers import *
|
||||||
|
|
||||||
|
from .models import *
|
||||||
|
|
||||||
|
|
||||||
# Сериализатор модели StateSize (Штатная численность)
|
# Сериализатор модели StateSize (Штатная численность)
|
||||||
class StateSizeSerializer(serializers.ModelSerializer):
|
class StateSizeSerializer(serializers.ModelSerializer):
|
||||||
size= serializers.IntegerField(source='statesize')
|
size = serializers.IntegerField(source="statesize")
|
||||||
class Meta:
|
|
||||||
model = StateSize
|
class Meta:
|
||||||
fields ='__all__'
|
model = StateSize
|
||||||
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
# Сериализатор модели FactSize (Фактическая численность)
|
# Сериализатор модели FactSize (Фактическая численность)
|
||||||
class FactSizeSerializer(serializers.ModelSerializer):
|
class FactSizeSerializer(serializers.ModelSerializer):
|
||||||
size= serializers.IntegerField(source='factsize')
|
size = serializers.IntegerField(source="factsize")
|
||||||
class Meta:
|
|
||||||
model = FactSize
|
class Meta:
|
||||||
fields ='__all__'
|
model = FactSize
|
||||||
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
# Сериализатор модели InspectionDirections (Направление деятельности инспекции)
|
# Сериализатор модели InspectionDirections (Направление деятельности инспекции)
|
||||||
class InspectionDirectionsSerializer(serializers.ModelSerializer):
|
class InspectionDirectionsSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
class Meta:
|
model = InspectionDirections
|
||||||
model = InspectionDirections
|
fields = [
|
||||||
fields =['id', 'direction_title', 'icon_name',]
|
"id",
|
||||||
|
"direction_title",
|
||||||
|
"icon_name",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# Сериализаторы структуры инспекции
|
# Сериализаторы структуры инспекции
|
||||||
@@ -34,47 +44,48 @@ class InspectionDirectionsSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
# Основной сериализатор структуры инспекции
|
# Основной сериализатор структуры инспекции
|
||||||
class StructureSerializer(InfoUserCardSerializer):
|
class StructureSerializer(InfoUserCardSerializer):
|
||||||
deps = serializers.SerializerMethodField('get_deps',)
|
deps = serializers.SerializerMethodField(
|
||||||
|
"get_deps",
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = DictEmployee
|
model = DictEmployee
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
def get_deps(self, obj):
|
def get_deps(self, obj):
|
||||||
return DepsSerializer(obj.deps_curator.filter(deleted=0).all(), many=True).data
|
return DepsSerializer(obj.deps_curator.filter(deleted=0).all(), many=True).data
|
||||||
|
|
||||||
|
|
||||||
class DepsSerializer(serializers.ModelSerializer):
|
class DepsSerializer(serializers.ModelSerializer):
|
||||||
chief_deps =serializers.SerializerMethodField('get_chief_deps')
|
chief_deps = serializers.SerializerMethodField("get_chief_deps")
|
||||||
class Meta:
|
|
||||||
model = DictDepartment
|
|
||||||
fields = '__all__'
|
|
||||||
|
|
||||||
def get_chief_deps(self, obj):
|
class Meta:
|
||||||
return InfoUserCardSerializer(obj.id_chief).data
|
model = DictDepartment
|
||||||
|
fields = "__all__"
|
||||||
|
|
||||||
|
def get_chief_deps(self, obj):
|
||||||
|
return InfoUserCardSerializer(obj.id_chief).data
|
||||||
|
|
||||||
|
|
||||||
class DepartmentDirectionsSerializer(serializers.ModelSerializer):
|
class DepartmentDirectionsSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = InspectionDirections
|
model = InspectionDirections
|
||||||
fields = ["id","direction_title"]
|
fields = ["id", "direction_title"]
|
||||||
ordering = ['direction_title']
|
ordering = ["direction_title"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DepartmentSerializerVac(serializers.ModelSerializer):
|
class DepartmentSerializerVac(serializers.ModelSerializer):
|
||||||
department_directions= DepartmentDirectionsSerializer(many=True, read_only=True)
|
department_directions = DepartmentDirectionsSerializer(many=True, read_only=True)
|
||||||
class Meta:
|
|
||||||
model = DictDepartment
|
|
||||||
fields = ['id','name','department_directions']
|
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = DictDepartment
|
||||||
|
fields = ["id", "name", "department_directions"]
|
||||||
|
|
||||||
|
|
||||||
class VacanciesSerializer(serializers.ModelSerializer):
|
class VacanciesSerializer(serializers.ModelSerializer):
|
||||||
department = DepartmentSerializerVac(read_only=True)
|
department = DepartmentSerializerVac(read_only=True)
|
||||||
class Meta:
|
|
||||||
model = Vacancies
|
|
||||||
|
|
||||||
fields = ["id", "department", "name","functional","requirements"]
|
class Meta:
|
||||||
|
model = Vacancies
|
||||||
|
|
||||||
|
fields = ["id", "department", "name", "functional", "requirements"]
|
||||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
Regular → Executable
+7
-10
@@ -1,15 +1,12 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from .views import *
|
from .views import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('getfactsize/', GetFactSize.as_view(), name='getfactsize'),
|
path("getfactsize/", GetFactSize.as_view(), name="getfactsize"),
|
||||||
path('getstatesize/', GetStateSize.as_view(), name='getstatesize'),
|
path("getstatesize/", GetStateSize.as_view(), name="getstatesize"),
|
||||||
path('getinspectiondirections/', GetInspectionDirections.as_view(), name='getinspectiondirections'),
|
path("getinspectiondirections/", GetInspectionDirections.as_view(), name="getinspectiondirections"),
|
||||||
path('getstructure/', GetStructure.as_view(), name='getstructure'),
|
path("getstructure/", GetStructure.as_view(), name="getstructure"),
|
||||||
path('getvacancy/', GetVacancies.as_view(), name='getvacancy'),
|
path("getvacancy/", GetVacancies.as_view(), name="getvacancy"),
|
||||||
path('postresponsevacancy/', PostResponseVacancies.as_view(), name='postresponsevacancy'),
|
path("postresponsevacancy/", PostResponseVacancies.as_view(), name="postresponsevacancy"),
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
Regular → Executable
+34
-32
@@ -1,76 +1,78 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
import requests
|
||||||
from rest_framework.generics import ListAPIView
|
from rest_framework.generics import ListAPIView
|
||||||
from django.db.models import Q
|
from rest_framework.response import Response
|
||||||
from userauth.models import DictEmployee, DictPosition
|
|
||||||
from datetime import date
|
from userauth.models import DictEmployee
|
||||||
|
|
||||||
from .models import *
|
from .models import *
|
||||||
from .serializers import *
|
from .serializers import *
|
||||||
from rest_framework.response import Response
|
|
||||||
import json
|
|
||||||
import requests
|
|
||||||
|
|
||||||
|
|
||||||
class GetStateSize(ListAPIView):
|
class GetStateSize(ListAPIView):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
state_size ={}
|
state_size = {}
|
||||||
try:
|
try:
|
||||||
|
state_size = StateSizeSerializer(StateSize.objects.latest("date_created")).data
|
||||||
|
except Exception:
|
||||||
state_size = StateSizeSerializer(StateSize.objects.latest('date_created')).data
|
|
||||||
except Exception as e:
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Response(state_size)
|
return Response(state_size)
|
||||||
|
|
||||||
|
|
||||||
class GetFactSize(ListAPIView):
|
class GetFactSize(ListAPIView):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fact_size = {}
|
fact_size = {}
|
||||||
try:
|
try:
|
||||||
fact_size = FactSizeSerializer(FactSize.objects.latest('date_created')).data
|
fact_size = FactSizeSerializer(FactSize.objects.latest("date_created")).data
|
||||||
except Exception as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
return Response(fact_size)
|
return Response(fact_size)
|
||||||
|
|
||||||
|
|
||||||
class GetInspectionDirections(ListAPIView):
|
class GetInspectionDirections(ListAPIView):
|
||||||
|
queryset = InspectionDirections.objects.filter(department__isnull=True)
|
||||||
|
serializer_class = InspectionDirectionsSerializer
|
||||||
|
# отключает вывод информации о пагинации(count,previous,next, results)
|
||||||
|
paginator = None
|
||||||
|
|
||||||
queryset = InspectionDirections.objects.filter(department__isnull=True)
|
|
||||||
serializer_class = InspectionDirectionsSerializer
|
|
||||||
# отключает вывод информации о пагинации(count,previous,next, results)
|
|
||||||
paginator = None
|
|
||||||
|
|
||||||
class GetStructure(ListAPIView):
|
class GetStructure(ListAPIView):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
queryset = DictEmployee.objects.filter(id_dict_position__order_position__lte = 2, deleted=0).order_by('id_dict_position__order_position','familyname')
|
queryset = DictEmployee.objects.filter(id_dict_position__order_position__lte=2, deleted=0).order_by(
|
||||||
|
"id_dict_position__order_position", "familyname"
|
||||||
|
)
|
||||||
return Response(StructureSerializer(queryset, many=True).data)
|
return Response(StructureSerializer(queryset, many=True).data)
|
||||||
|
|
||||||
|
|
||||||
class GetVacancies(ListAPIView):
|
class GetVacancies(ListAPIView):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
queryset = Vacancies.objects.filter(published=True).order_by('department__order_department')
|
queryset = Vacancies.objects.filter(published=True).order_by("department__order_department")
|
||||||
return Response(VacanciesSerializer(queryset, many=True).data)
|
return Response(VacanciesSerializer(queryset, many=True).data)
|
||||||
|
|
||||||
|
|
||||||
class PostResponseVacancies(ListAPIView):
|
class PostResponseVacancies(ListAPIView):
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
|
|
||||||
a = ResponseVacancy.objects.create(**json.loads(request.data['data']), file = request.data['file'] if 'file' in request.data else None)
|
a = ResponseVacancy.objects.create(
|
||||||
print(request.data, 'aaaaaaaaaaaaaa')
|
**json.loads(request.data["data"]), file=request.data["file"] if "file" in request.data else None
|
||||||
|
)
|
||||||
|
print(request.data, "aaaaaaaaaaaaaa")
|
||||||
|
|
||||||
okib = DictDepartment.objects.get(id=22)
|
okib = DictDepartment.objects.get(id=22)
|
||||||
data = {'sendto':[a.vacancy.department.id_chief.lotus, okib.id_chief.lotus], 'subject': f'Отклик на вакансию {a.vacancy.name} от {a.fio}', 'body_text':f'Почта:{a.email} ----- Телефон: {a.tel} ---- Сопроводительное письмо: {a.text}'}
|
data = {
|
||||||
|
"sendto": [a.vacancy.department.id_chief.lotus, okib.id_chief.lotus],
|
||||||
|
"subject": f"Отклик на вакансию {a.vacancy.name} от {a.fio}",
|
||||||
|
"body_text": f"Почта:{a.email} ----- Телефон: {a.tel} ---- Сопроводительное письмо: {a.text}",
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
requests.post('http://10.252.44.13:8005/', data = data, files = [request.data['file']] if 'file' in request.data else [], timeout=2)
|
requests.post(
|
||||||
|
"http://10.252.44.13:8005/", data=data, files=[request.data["file"]] if "file" in request.data else [], timeout=2
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
|
return Response("Ваше резюме отправленно")
|
||||||
return Response('Ваше резюме отправленно')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
+6
-4
@@ -1,15 +1,17 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from .models import *
|
from .models import *
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
||||||
|
|
||||||
class UserAdmin(admin.ModelAdmin):
|
class UserAdmin(admin.ModelAdmin):
|
||||||
save_on_top = True
|
save_on_top = True
|
||||||
list_display=('username','names', 'is_active', 'is_staff')
|
list_display = ("username", "names", "is_active", "is_staff")
|
||||||
search_fields = ('username',)
|
search_fields = ("username",)
|
||||||
ordering=('username',)
|
ordering = ("username",)
|
||||||
|
|
||||||
# fields=(('user', 'username'), 'is_active', 'is_staff', 'updated_at',)
|
# fields=(('user', 'username'), 'is_active', 'is_staff', 'updated_at',)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(User, UserAdmin)
|
admin.site.register(User, UserAdmin)
|
||||||
Regular → Executable
+3
-3
@@ -2,7 +2,7 @@ from django.apps import AppConfig
|
|||||||
|
|
||||||
|
|
||||||
class AccountsConfig(AppConfig):
|
class AccountsConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
name = 'accounts'
|
name = "accounts"
|
||||||
|
|
||||||
verbose_name='Аккаунты Портала'
|
verbose_name = "Аккаунты Портала"
|
||||||
Regular → Executable
+40
-44
@@ -1,16 +1,15 @@
|
|||||||
import jwt
|
|
||||||
import requests
|
|
||||||
import json
|
import json
|
||||||
from django.conf import settings
|
|
||||||
from portal.settings import myDEBUG
|
import requests
|
||||||
from django.forms.models import model_to_dict
|
|
||||||
from rest_framework import authentication, exceptions
|
|
||||||
from datetime import datetime
|
|
||||||
from .models import User
|
|
||||||
from userauth.models import *
|
|
||||||
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
|
|
||||||
from rest_framework_simplejwt.views import TokenObtainPairView
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.forms.models import model_to_dict
|
||||||
|
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
|
||||||
|
|
||||||
|
from portal.settings import myDEBUG
|
||||||
|
from userauth.models import *
|
||||||
|
|
||||||
|
from .models import User
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
@@ -18,6 +17,7 @@ User = get_user_model()
|
|||||||
# def __init__(self, *args):
|
# def __init__(self, *args):
|
||||||
# self.message = args[0] if args else "None"
|
# self.message = args[0] if args else "None"
|
||||||
|
|
||||||
|
|
||||||
class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
|
class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_token(cls, user):
|
def get_token(cls, user):
|
||||||
@@ -26,72 +26,68 @@ class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
|
|||||||
|
|
||||||
# TODO В зависимости от базы Алексея, добавить поля или нет - надо подумать
|
# TODO В зависимости от базы Алексея, добавить поля или нет - надо подумать
|
||||||
|
|
||||||
|
token["user"] = model_to_dict(user.userinfo)
|
||||||
token['user']=model_to_dict(user.userinfo)
|
token["user"]["is_active"] = user.is_active
|
||||||
token['user']['is_active']=user.is_active
|
token["user"]["is_staff"] = user.is_staff
|
||||||
token['user']['is_staff']=user.is_staff
|
token["user"]["is_superuser"] = user.is_superuser
|
||||||
token['user']['is_superuser']=user.is_superuser
|
token["user"]["is_idEmployee"] = user.user_id
|
||||||
token['user']['is_idEmployee']=user.user_id
|
|
||||||
# !ТУТ СДЕЛАТь ФОТО НАВЕРНОЕ
|
# !ТУТ СДЕЛАТь ФОТО НАВЕРНОЕ
|
||||||
# token['user']['last_login']= user.last_login
|
# token['user']['last_login']= user.last_login
|
||||||
# print(token)
|
# print(token)
|
||||||
return token
|
return token
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("ERRRORRRRRRRR")
|
print("ERRRORRRRRRRR")
|
||||||
print (e)
|
print(e)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from django.contrib.auth.backends import ModelBackend
|
from django.contrib.auth.backends import ModelBackend
|
||||||
|
|
||||||
# from django.contrib.auth.models import User
|
# from django.contrib.auth.models import User
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
class CustomAuth(ModelBackend):
|
|
||||||
|
|
||||||
|
class CustomAuth(ModelBackend):
|
||||||
def authenticate(self, request, **kwargs):
|
def authenticate(self, request, **kwargs):
|
||||||
username = kwargs['username']
|
username = kwargs["username"]
|
||||||
password = kwargs['password']
|
password = kwargs["password"]
|
||||||
status_code=0
|
status_code = 0
|
||||||
|
|
||||||
# !ТУт стучим в AD, потом к Алексею
|
# !ТУт стучим в AD, потом к Алексею
|
||||||
if myDEBUG!="True":
|
if myDEBUG != "True":
|
||||||
|
resp = requests.post(
|
||||||
resp= requests.post('http://10.252.44.13:8005/getAD', json.dumps({'user': username, 'password':password, 'usercheck': username}))
|
"http://10.252.44.13:8005/getAD", json.dumps({"user": username, "password": password, "usercheck": username})
|
||||||
|
)
|
||||||
|
|
||||||
# if True:
|
# if True:
|
||||||
status_code=resp.status_code
|
status_code = resp.status_code
|
||||||
else:
|
else:
|
||||||
|
status_code = 200
|
||||||
status_code=200
|
|
||||||
# status_code=403
|
# status_code=403
|
||||||
|
|
||||||
|
if status_code == 200:
|
||||||
if status_code==200:
|
|
||||||
# try:
|
# try:
|
||||||
|
|
||||||
user = DictEmployee.objects.get(login=username)
|
user = DictEmployee.objects.get(login=username)
|
||||||
|
|
||||||
if user.deleted!=1:
|
if user.deleted != 1:
|
||||||
homeuser, created = User.objects.get_or_create(username=username)
|
homeuser, created = User.objects.get_or_create(username=username)
|
||||||
if created:
|
if created:
|
||||||
homeuser.set_unusable_password()
|
homeuser.set_unusable_password()
|
||||||
|
|
||||||
homeuser.last_login= timezone.now()
|
homeuser.last_login = timezone.now()
|
||||||
homeuser.user=user
|
homeuser.user = user
|
||||||
user.is_active=homeuser.is_active
|
user.is_active = homeuser.is_active
|
||||||
user.is_staff=homeuser.is_staff
|
user.is_staff = homeuser.is_staff
|
||||||
user.is_idEmployee=homeuser.user_id
|
user.is_idEmployee = homeuser.user_id
|
||||||
user.last_login=homeuser.last_login.strftime('%Y-%d-%m %H:%M:%S')
|
user.last_login = homeuser.last_login.strftime("%Y-%d-%m %H:%M:%S")
|
||||||
homeuser.save()
|
homeuser.save()
|
||||||
if user.birthdate is not None:
|
if user.birthdate is not None:
|
||||||
homeuser.birthdate = user.birthdate.strftime('%Y-%d-%m %H:%M:%S')
|
homeuser.birthdate = user.birthdate.strftime("%Y-%d-%m %H:%M:%S")
|
||||||
else:
|
else:
|
||||||
homeuser.birthdate = None
|
homeuser.birthdate = None
|
||||||
user.birthdate=homeuser.birthdate
|
user.birthdate = homeuser.birthdate
|
||||||
homeuser.last_login=user.last_login
|
homeuser.last_login = user.last_login
|
||||||
user.id=homeuser.id
|
user.id = homeuser.id
|
||||||
homeuser.userinfo = user
|
homeuser.userinfo = user
|
||||||
|
|
||||||
return homeuser
|
return homeuser
|
||||||
|
|
||||||
|
|
||||||
Regular → Executable
+54
-19
@@ -1,38 +1,73 @@
|
|||||||
# Generated by Django 4.2.3 on 2025-01-31 09:40
|
# Generated by Django 4.2.3 on 2025-01-31 09:40
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('auth', '0012_alter_user_first_name_max_length'),
|
("auth", "0012_alter_user_first_name_max_length"),
|
||||||
('userauth', '0001_initial'),
|
("userauth", "0001_initial"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='User',
|
name="User",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
|
("last_login", models.DateTimeField(blank=True, null=True, verbose_name="last login")),
|
||||||
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
|
(
|
||||||
('password', models.CharField(blank=True, max_length=128, null=True, verbose_name='Пароль')),
|
"is_superuser",
|
||||||
('username', models.CharField(db_index=True, max_length=255, unique=True, verbose_name='Логин')),
|
models.BooleanField(
|
||||||
('is_active', models.BooleanField(default=True, verbose_name='Активность')),
|
default=False,
|
||||||
('is_staff', models.BooleanField(default=False, verbose_name='Доступ в Админку')),
|
help_text="Designates that this user has all permissions without explicitly assigning them.",
|
||||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
verbose_name="superuser status",
|
||||||
('updated_at', models.DateTimeField(auto_now=True)),
|
),
|
||||||
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
|
),
|
||||||
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='userauth.dictemployee', verbose_name='Сотрудник')),
|
("password", models.CharField(blank=True, max_length=128, null=True, verbose_name="Пароль")),
|
||||||
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
|
("username", models.CharField(db_index=True, max_length=255, unique=True, verbose_name="Логин")),
|
||||||
|
("is_active", models.BooleanField(default=True, verbose_name="Активность")),
|
||||||
|
("is_staff", models.BooleanField(default=False, verbose_name="Доступ в Админку")),
|
||||||
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||||
|
("updated_at", models.DateTimeField(auto_now=True)),
|
||||||
|
(
|
||||||
|
"groups",
|
||||||
|
models.ManyToManyField(
|
||||||
|
blank=True,
|
||||||
|
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
|
||||||
|
related_name="user_set",
|
||||||
|
related_query_name="user",
|
||||||
|
to="auth.group",
|
||||||
|
verbose_name="groups",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"user",
|
||||||
|
models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
|
to="userauth.dictemployee",
|
||||||
|
verbose_name="Сотрудник",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"user_permissions",
|
||||||
|
models.ManyToManyField(
|
||||||
|
blank=True,
|
||||||
|
help_text="Specific permissions for this user.",
|
||||||
|
related_name="user_set",
|
||||||
|
related_query_name="user",
|
||||||
|
to="auth.permission",
|
||||||
|
verbose_name="user permissions",
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Зарегистрированный участник',
|
"verbose_name": "Зарегистрированный участник",
|
||||||
'verbose_name_plural': 'Зарегистрированные участники',
|
"verbose_name_plural": "Зарегистрированные участники",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
+17
-36
@@ -1,21 +1,9 @@
|
|||||||
|
|
||||||
from datetime import datetime
|
|
||||||
from django.db import models
|
|
||||||
from django.contrib.auth.models import AbstractUser
|
|
||||||
from django.contrib.auth.models import UserManager
|
|
||||||
from django.contrib.auth.base_user import (AbstractBaseUser, BaseUserManager)
|
|
||||||
import jwt
|
|
||||||
from django.contrib.auth.models import PermissionsMixin
|
|
||||||
from django.conf import settings
|
|
||||||
# from django.utils.translation import ugettext_lazy as _
|
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
|
||||||
from rest_framework.serializers import ValidationError
|
|
||||||
# from orgmanagment.models import *
|
# from orgmanagment.models import *
|
||||||
from datetime import datetime, timedelta
|
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
|
||||||
import requests
|
from django.contrib.auth.models import PermissionsMixin, UserManager
|
||||||
from django.contrib.auth import authenticate
|
from django.db import models
|
||||||
import json
|
|
||||||
from django.forms.models import model_to_dict
|
# from django.utils.translation import ugettext_lazy as _
|
||||||
from userauth.models import DictEmployee
|
from userauth.models import DictEmployee
|
||||||
|
|
||||||
# all_fk: dict = {
|
# all_fk: dict = {
|
||||||
@@ -34,14 +22,14 @@ from userauth.models import DictEmployee
|
|||||||
# def __str__(self):
|
# def __str__(self):
|
||||||
# return str(self.name)
|
# return str(self.name)
|
||||||
|
|
||||||
|
|
||||||
class UserManager(BaseUserManager):
|
class UserManager(BaseUserManager):
|
||||||
|
def create_superuser(self, username, password):
|
||||||
def create_superuser(self, username, password):
|
"""Создает и возввращет пользователя с привилегиями суперадмина."""
|
||||||
""" Создает и возввращет пользователя с привилегиями суперадмина. """
|
|
||||||
if password is None:
|
if password is None:
|
||||||
raise TypeError('Superusers must have a password.')
|
raise TypeError("Superusers must have a password.")
|
||||||
|
|
||||||
user = self.create_user(username, password)
|
user = self.create_user(username, password)
|
||||||
user.is_superuser = True
|
user.is_superuser = True
|
||||||
user.is_staff = True
|
user.is_staff = True
|
||||||
user.set_password(password)
|
user.set_password(password)
|
||||||
@@ -50,30 +38,24 @@ class UserManager(BaseUserManager):
|
|||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class User(AbstractBaseUser, PermissionsMixin):
|
class User(AbstractBaseUser, PermissionsMixin):
|
||||||
user = models.ForeignKey(DictEmployee, on_delete=models.PROTECT, null=True, blank=True, verbose_name='Сотрудник')
|
user = models.ForeignKey(DictEmployee, on_delete=models.PROTECT, null=True, blank=True, verbose_name="Сотрудник")
|
||||||
password = models.CharField(max_length=128, null=True,blank=True,verbose_name='Пароль')
|
password = models.CharField(max_length=128, null=True, blank=True, verbose_name="Пароль")
|
||||||
username = models.CharField(db_index=True, max_length=255, unique=True, verbose_name='Логин')
|
username = models.CharField(db_index=True, max_length=255, unique=True, verbose_name="Логин")
|
||||||
# username2 = models.CharField(db_index=True, null=True, max_length=255, unique=True)
|
# username2 = models.CharField(db_index=True, null=True, max_length=255, unique=True)
|
||||||
is_active = models.BooleanField(default=True, verbose_name='Активность')
|
is_active = models.BooleanField(default=True, verbose_name="Активность")
|
||||||
is_staff = models.BooleanField(default=False, verbose_name='Доступ в Админку')
|
is_staff = models.BooleanField(default=False, verbose_name="Доступ в Админку")
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
# last_login = models.DateTimeField(auto_now=True, null=True)
|
# last_login = models.DateTimeField(auto_now=True, null=True)
|
||||||
# external=models.ForeignKey(DictEmployee,db_constraint=False, null=True, on_delete=models.PROTECT)
|
# external=models.ForeignKey(DictEmployee,db_constraint=False, null=True, on_delete=models.PROTECT)
|
||||||
objects = UserManager()
|
objects = UserManager()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
verbose_name = "Зарегистрированный участник"
|
verbose_name = "Зарегистрированный участник"
|
||||||
verbose_name_plural = "Зарегистрированные участники"
|
verbose_name_plural = "Зарегистрированные участники"
|
||||||
|
|
||||||
USERNAME_FIELD = 'username'
|
USERNAME_FIELD = "username"
|
||||||
|
|
||||||
# REQUIRED_FIELDS = ['username']
|
# REQUIRED_FIELDS = ['username']
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@@ -83,8 +65,7 @@ class User(AbstractBaseUser, PermissionsMixin):
|
|||||||
|
|
||||||
return self.user.login
|
return self.user.login
|
||||||
|
|
||||||
|
|
||||||
def names(self):
|
def names(self):
|
||||||
return DictEmployee.objects.get(login=self.username)
|
return DictEmployee.objects.get(login=self.username)
|
||||||
|
|
||||||
names.short_description="ФИО"
|
names.short_description = "ФИО"
|
||||||
Regular → Executable
+8
-7
@@ -4,19 +4,20 @@ from rest_framework.renderers import JSONRenderer
|
|||||||
|
|
||||||
|
|
||||||
class UserJSONRenderer(JSONRenderer):
|
class UserJSONRenderer(JSONRenderer):
|
||||||
charset = 'utf-8'
|
charset = "utf-8"
|
||||||
|
|
||||||
def render(self, data, media_type=None, renderer_context=None):
|
def render(self, data, media_type=None, renderer_context=None):
|
||||||
# Если мы получим ключ token как часть ответа, это будет байтовый
|
# Если мы получим ключ token как часть ответа, это будет байтовый
|
||||||
# объект. Байтовые объекты плохо сериализуются, поэтому нам нужно
|
# объект. Байтовые объекты плохо сериализуются, поэтому нам нужно
|
||||||
# декодировать их перед рендерингом объекта User.
|
# декодировать их перед рендерингом объекта User.
|
||||||
token = data.get('token', None)
|
token = data.get("token", None)
|
||||||
|
|
||||||
if token is not None and isinstance(token, bytes):
|
if token is not None and isinstance(token, bytes):
|
||||||
# Как говорится выше, декодирует token если он имеет тип bytes.
|
# Как говорится выше, декодирует token если он имеет тип bytes.
|
||||||
data['token'] = token.decode('utf-8')
|
data["token"] = token.decode("utf-8")
|
||||||
# Наконец, мы можем отобразить наши данные в простанстве имен 'user'.
|
# Наконец, мы можем отобразить наши данные в простанстве имен 'user'.
|
||||||
return json.dumps({
|
return json.dumps(
|
||||||
'user': data,
|
{
|
||||||
|
"user": data,
|
||||||
})
|
}
|
||||||
|
)
|
||||||
Regular → Executable
-3
@@ -1,3 +0,0 @@
|
|||||||
from rest_framework import serializers
|
|
||||||
from django.contrib.auth import authenticate
|
|
||||||
from .models import User
|
|
||||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
Regular → Executable
+10
-14
@@ -1,19 +1,15 @@
|
|||||||
from django.urls import include, path
|
from django.urls import path
|
||||||
from rest_framework.routers import DefaultRouter
|
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView
|
||||||
|
|
||||||
from .views import *
|
from .views import *
|
||||||
|
|
||||||
from rest_framework_simplejwt.views import (
|
|
||||||
TokenObtainPairView,
|
|
||||||
TokenRefreshView,TokenVerifyView
|
|
||||||
)
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
path("token/", TokenObtainPairView.as_view(), name="token_obtain_pair"),
|
||||||
path('token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
path("token/refresh/", TokenRefreshView.as_view(), name="token_refresh"),
|
||||||
path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
path("token/verify/", TokenVerifyView.as_view(), name="token_access"),
|
||||||
path('token/verify/', TokenVerifyView.as_view(), name='token_access'),
|
path(
|
||||||
path('getuser/', getuserAPIView.as_view(), name='getuserAPIView', ),
|
"getuser/",
|
||||||
|
getuserAPIView.as_view(),
|
||||||
|
name="getuserAPIView",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
Regular → Executable
+7
-10
@@ -1,10 +1,12 @@
|
|||||||
from rest_framework.permissions import AllowAny, IsAuthenticated
|
from rest_framework.permissions import AllowAny
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from userauth.models import *
|
|
||||||
from navigation.models import *
|
from navigation.models import *
|
||||||
from navigation.serializers import *
|
from navigation.serializers import *
|
||||||
|
from userauth.models import *
|
||||||
from userauth.serializers import *
|
from userauth.serializers import *
|
||||||
|
|
||||||
from .models import *
|
from .models import *
|
||||||
from .serializers import *
|
from .serializers import *
|
||||||
|
|
||||||
@@ -20,18 +22,13 @@ class getuserAPIView(APIView):
|
|||||||
Если дать дополнительный параметр fullinfo = True, то будет выдаваться информация с комиссиями и ответсвенностью
|
Если дать дополнительный параметр fullinfo = True, то будет выдаваться информация с комиссиями и ответсвенностью
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
resp = None
|
resp = None
|
||||||
fullinfo = request.query_params.get('fullinfo')
|
fullinfo = request.query_params.get("fullinfo")
|
||||||
queryset = DictEmployee.objects.get(login=request.query_params.get('userlogin'))
|
queryset = DictEmployee.objects.get(login=request.query_params.get("userlogin"))
|
||||||
if(fullinfo is None or fullinfo == False ):
|
if fullinfo is None or fullinfo == False:
|
||||||
resp = InfoUserCardSerializer(queryset).data
|
resp = InfoUserCardSerializer(queryset).data
|
||||||
|
|
||||||
else:
|
else:
|
||||||
resp = CardUserSerializer(queryset).data
|
resp = CardUserSerializer(queryset).data
|
||||||
|
|
||||||
return Response(resp)
|
return Response(resp)
|
||||||
|
|
||||||
|
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
+4
-1
@@ -1,10 +1,13 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from .models import *
|
from .models import *
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
||||||
|
|
||||||
class ExclusionDatesAdmin(admin.ModelAdmin):
|
class ExclusionDatesAdmin(admin.ModelAdmin):
|
||||||
list_display=('exclusiondate',)
|
list_display = ("exclusiondate",)
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(ExclusionDates, ExclusionDatesAdmin)
|
admin.site.register(ExclusionDates, ExclusionDatesAdmin)
|
||||||
admin.site.register(Calendar)
|
admin.site.register(Calendar)
|
||||||
|
|||||||
Regular → Executable
+3
-3
@@ -2,6 +2,6 @@ from django.apps import AppConfig
|
|||||||
|
|
||||||
|
|
||||||
class CalendarOfEventsConfig(AppConfig):
|
class CalendarOfEventsConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
name = 'calendar_of_events'
|
name = "calendar_of_events"
|
||||||
verbose_name = 'Календарь событий'
|
verbose_name = "Календарь событий"
|
||||||
Regular → Executable
+103
-47
@@ -1,97 +1,153 @@
|
|||||||
# Generated by Django 4.2.3 on 2025-01-31 09:42
|
# Generated by Django 4.2.3 on 2025-01-31 09:42
|
||||||
|
|
||||||
import ckeditor_uploader.fields
|
import ckeditor_uploader.fields
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('userauth', '0001_initial'),
|
("userauth", "0001_initial"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Calendar',
|
name="Calendar",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('cl_name', models.CharField(max_length=300, verbose_name='Название')),
|
("cl_name", models.CharField(max_length=300, verbose_name="Название")),
|
||||||
('cl_color', models.CharField(max_length=300, null=True, verbose_name='Цвет')),
|
("cl_color", models.CharField(max_length=300, null=True, verbose_name="Цвет")),
|
||||||
('cl_descr', models.CharField(max_length=300, verbose_name='Описание')),
|
("cl_descr", models.CharField(max_length=300, verbose_name="Описание")),
|
||||||
('author', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='userauth.dictemployee', verbose_name='Автор календаря')),
|
(
|
||||||
|
"author",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.PROTECT, to="userauth.dictemployee", verbose_name="Автор календаря"
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Календарь',
|
"verbose_name": "Календарь",
|
||||||
'verbose_name_plural': 'Календари',
|
"verbose_name_plural": "Календари",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Event',
|
name="Event",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('name', models.CharField(blank=True, max_length=300, null=True, verbose_name='Название')),
|
("name", models.CharField(blank=True, max_length=300, null=True, verbose_name="Название")),
|
||||||
('date_start', models.DateTimeField(blank=True, null=True, verbose_name='Дата начала события')),
|
("date_start", models.DateTimeField(blank=True, null=True, verbose_name="Дата начала события")),
|
||||||
('date_end', models.DateTimeField(blank=True, null=True, verbose_name='Дата окончания события')),
|
("date_end", models.DateTimeField(blank=True, null=True, verbose_name="Дата окончания события")),
|
||||||
('period', models.JSONField(blank=True, null=True, verbose_name='Периодичность события')),
|
("period", models.JSONField(blank=True, null=True, verbose_name="Периодичность события")),
|
||||||
('description', ckeditor_uploader.fields.RichTextUploadingField(blank=True, null=True, verbose_name='Описание события')),
|
(
|
||||||
('allday', models.BooleanField(default=False, verbose_name='Событие на целый день')),
|
"description",
|
||||||
('calendar', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='get_calendar_event', to='calendar_of_events.calendar', verbose_name='Календарь')),
|
ckeditor_uploader.fields.RichTextUploadingField(blank=True, null=True, verbose_name="Описание события"),
|
||||||
|
),
|
||||||
|
("allday", models.BooleanField(default=False, verbose_name="Событие на целый день")),
|
||||||
|
(
|
||||||
|
"calendar",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="get_calendar_event",
|
||||||
|
to="calendar_of_events.calendar",
|
||||||
|
verbose_name="Календарь",
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Событие календаря',
|
"verbose_name": "Событие календаря",
|
||||||
'verbose_name_plural': 'События календаря',
|
"verbose_name_plural": "События календаря",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='ExclusionDates',
|
name="ExclusionDates",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('exclusiondate', models.DateField(blank=True, null=True, verbose_name='Дата-исключение')),
|
("exclusiondate", models.DateField(blank=True, null=True, verbose_name="Дата-исключение")),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Дата-исключение',
|
"verbose_name": "Дата-исключение",
|
||||||
'verbose_name_plural': 'Даты-исключение',
|
"verbose_name_plural": "Даты-исключение",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='EventParticipant',
|
name="EventParticipant",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='get_event_participant', to='calendar_of_events.event', verbose_name='Календарь')),
|
(
|
||||||
('participant', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='get_user_event', to='userauth.dictemployee', verbose_name='Участник')),
|
"event",
|
||||||
|
models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="get_event_participant",
|
||||||
|
to="calendar_of_events.event",
|
||||||
|
verbose_name="Календарь",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"participant",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
|
related_name="get_user_event",
|
||||||
|
to="userauth.dictemployee",
|
||||||
|
verbose_name="Участник",
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Участники события',
|
"verbose_name": "Участники события",
|
||||||
'verbose_name_plural': 'Участники событий',
|
"verbose_name_plural": "Участники событий",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='EventFiles',
|
name="EventFiles",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('file', models.FileField(upload_to='calendar/%Y/%m/%d')),
|
("file", models.FileField(upload_to="calendar/%Y/%m/%d")),
|
||||||
('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='get_calendar_event_files', to='calendar_of_events.event', verbose_name='Событие')),
|
(
|
||||||
|
"event",
|
||||||
|
models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
|
related_name="get_calendar_event_files",
|
||||||
|
to="calendar_of_events.event",
|
||||||
|
verbose_name="Событие",
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Файлы календаря',
|
"verbose_name": "Файлы календаря",
|
||||||
'verbose_name_plural': 'Файлы календаря',
|
"verbose_name_plural": "Файлы календаря",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='CalendarParticipants',
|
name="CalendarParticipants",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('editor', models.BooleanField(default=False, verbose_name='Редактирование')),
|
("editor", models.BooleanField(default=False, verbose_name="Редактирование")),
|
||||||
('calendar', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='get_participants', to='calendar_of_events.calendar', verbose_name='Календарь')),
|
(
|
||||||
('participant_calendar', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='userauth.dictemployee', verbose_name='Участник')),
|
"calendar",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="get_participants",
|
||||||
|
to="calendar_of_events.calendar",
|
||||||
|
verbose_name="Календарь",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"participant_calendar",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.PROTECT, to="userauth.dictemployee", verbose_name="Участник"
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Участники календаря',
|
"verbose_name": "Участники календаря",
|
||||||
'verbose_name_plural': 'Участники календаря',
|
"verbose_name_plural": "Участники календаря",
|
||||||
'unique_together': {('participant_calendar', 'calendar')},
|
"unique_together": {("participant_calendar", "calendar")},
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
Regular → Executable
-1
@@ -5,7 +5,6 @@ from django.db import migrations, models
|
|||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("calendar_of_events", "0001_initial"),
|
("calendar_of_events", "0001_initial"),
|
||||||
("userauth", "0001_initial"),
|
("userauth", "0001_initial"),
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 5.1.6 on 2026-12-02 06:43
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('calendar_of_events', '0002_alter_calendar_author'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='eventfiles',
|
||||||
|
name='event',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='get_calendar_event_files', to='calendar_of_events.event', verbose_name='Событие'),
|
||||||
|
),
|
||||||
|
]
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
+38
-31
@@ -1,10 +1,10 @@
|
|||||||
from django.db import models
|
|
||||||
from accounts.models import *
|
|
||||||
# Create your models here.
|
|
||||||
from django.conf import settings
|
|
||||||
# from enum import Enum
|
# from enum import Enum
|
||||||
from ckeditor_uploader.fields import RichTextUploadingField
|
from ckeditor_uploader.fields import RichTextUploadingField
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
from accounts.models import *
|
||||||
|
|
||||||
# class CalendarEventsName(models.Model):
|
# class CalendarEventsName(models.Model):
|
||||||
# """ Глобавльное название календаря"""
|
# """ Глобавльное название календаря"""
|
||||||
@@ -12,10 +12,8 @@ from ckeditor_uploader.fields import RichTextUploadingField
|
|||||||
# author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор Календаря')
|
# author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор Календаря')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# class CalendarEvents(models.Model):
|
# class CalendarEvents(models.Model):
|
||||||
# """ Основные данные по событиям"""
|
# """ Основные данные по событиям"""
|
||||||
# name=models.CharField(max_length=300, verbose_name='Название события')
|
# name=models.CharField(max_length=300, verbose_name='Название события')
|
||||||
# description = RichTextUploadingField(null=True, blank= True, verbose_name='Описание события')
|
# description = RichTextUploadingField(null=True, blank= True, verbose_name='Описание события')
|
||||||
# content = RichTextUploadingField(null=True, blank= True, verbose_name='Полное описание события')
|
# content = RichTextUploadingField(null=True, blank= True, verbose_name='Полное описание события')
|
||||||
@@ -49,11 +47,10 @@ from ckeditor_uploader.fields import RichTextUploadingField
|
|||||||
|
|
||||||
# Модели(Таблицы) для хранения календаря
|
# Модели(Таблицы) для хранения календаря
|
||||||
class Calendar(models.Model):
|
class Calendar(models.Model):
|
||||||
author = models.ForeignKey(DictEmployee, on_delete=models.PROTECT, null=True, verbose_name='Автор календаря')
|
author = models.ForeignKey(DictEmployee, on_delete=models.PROTECT, null=True, verbose_name="Автор календаря")
|
||||||
cl_name = models.CharField(max_length=300, verbose_name='Название')
|
cl_name = models.CharField(max_length=300, verbose_name="Название")
|
||||||
cl_color = models.CharField(max_length=300, verbose_name='Цвет', null=True)
|
cl_color = models.CharField(max_length=300, verbose_name="Цвет", null=True)
|
||||||
cl_descr = models.CharField(max_length=300, verbose_name='Описание')
|
cl_descr = models.CharField(max_length=300, verbose_name="Описание")
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Календарь"
|
verbose_name = "Календарь"
|
||||||
@@ -62,10 +59,11 @@ class Calendar(models.Model):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.cl_name)
|
return str(self.cl_name)
|
||||||
|
|
||||||
|
|
||||||
class CalendarParticipants(models.Model):
|
class CalendarParticipants(models.Model):
|
||||||
participant_calendar = models.ForeignKey(DictEmployee, on_delete=models.PROTECT, verbose_name='Участник')
|
participant_calendar = models.ForeignKey(DictEmployee, on_delete=models.PROTECT, verbose_name="Участник")
|
||||||
calendar = models.ForeignKey(Calendar, on_delete=models.CASCADE, related_name='get_participants', verbose_name='Календарь')
|
calendar = models.ForeignKey(Calendar, on_delete=models.CASCADE, related_name="get_participants", verbose_name="Календарь")
|
||||||
editor = models.BooleanField(default=False, verbose_name='Редактирование')
|
editor = models.BooleanField(default=False, verbose_name="Редактирование")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ["participant_calendar", "calendar"]
|
unique_together = ["participant_calendar", "calendar"]
|
||||||
@@ -75,16 +73,16 @@ class CalendarParticipants(models.Model):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.participant_calendar)
|
return str(self.participant_calendar)
|
||||||
|
|
||||||
class Event(models.Model):
|
|
||||||
name = models.CharField(max_length=300, verbose_name='Название', null=True, blank=True)
|
|
||||||
# author = models.ForeignKey(DictEmployee, blank=True,null=True,on_delete=models.PROTECT, verbose_name='Автор события')
|
|
||||||
calendar = models.ForeignKey(Calendar, on_delete=models.CASCADE, related_name='get_calendar_event', verbose_name='Календарь')
|
|
||||||
date_start = models.DateTimeField(null=True, blank= True, verbose_name='Дата начала события')
|
|
||||||
date_end = models.DateTimeField(null=True, blank= True, verbose_name='Дата окончания события')
|
|
||||||
period = models.JSONField(verbose_name='Периодичность события', null=True, blank= True)
|
|
||||||
description = RichTextUploadingField(null=True, blank= True, verbose_name='Описание события')
|
|
||||||
allday = models.BooleanField(default=False, verbose_name='Событие на целый день')
|
|
||||||
|
|
||||||
|
class Event(models.Model):
|
||||||
|
name = models.CharField(max_length=300, verbose_name="Название", null=True, blank=True)
|
||||||
|
# author = models.ForeignKey(DictEmployee, blank=True,null=True,on_delete=models.PROTECT, verbose_name='Автор события')
|
||||||
|
calendar = models.ForeignKey(Calendar, on_delete=models.CASCADE, related_name="get_calendar_event", verbose_name="Календарь")
|
||||||
|
date_start = models.DateTimeField(null=True, blank=True, verbose_name="Дата начала события")
|
||||||
|
date_end = models.DateTimeField(null=True, blank=True, verbose_name="Дата окончания события")
|
||||||
|
period = models.JSONField(verbose_name="Периодичность события", null=True, blank=True)
|
||||||
|
description = RichTextUploadingField(null=True, blank=True, verbose_name="Описание события")
|
||||||
|
allday = models.BooleanField(default=False, verbose_name="Событие на целый день")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Событие календаря"
|
verbose_name = "Событие календаря"
|
||||||
@@ -93,10 +91,13 @@ class Event(models.Model):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.name)
|
return str(self.name)
|
||||||
|
|
||||||
|
|
||||||
class EventFiles(models.Model):
|
class EventFiles(models.Model):
|
||||||
# event = models.ForeignKey(Event, on_delete=models.PROTECT, related_name='get_calendar_event_files',blank=True,null=True, verbose_name='Событие')
|
# event = models.ForeignKey(Event, on_delete=models.PROTECT, related_name='get_calendar_event_files',blank=True,null=True, verbose_name='Событие')
|
||||||
event = models.ForeignKey(Event, on_delete=models.CASCADE, related_name='get_calendar_event_files',blank=True,null=True, verbose_name='Событие')
|
event = models.ForeignKey(
|
||||||
file = models.FileField(upload_to='calendar/%Y/%m/%d')
|
Event, on_delete=models.CASCADE, related_name="get_calendar_event_files", blank=True, null=True, verbose_name="Событие"
|
||||||
|
)
|
||||||
|
file = models.FileField(upload_to="calendar/%Y/%m/%d")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Файлы календаря"
|
verbose_name = "Файлы календаря"
|
||||||
@@ -105,9 +106,14 @@ class EventFiles(models.Model):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.file)
|
return str(self.file)
|
||||||
|
|
||||||
|
|
||||||
class EventParticipant(models.Model):
|
class EventParticipant(models.Model):
|
||||||
participant = models.ForeignKey(DictEmployee, on_delete=models.PROTECT, related_name='get_user_event', verbose_name='Участник')
|
participant = models.ForeignKey(
|
||||||
event = models.ForeignKey(Event, blank=True,null=True, on_delete=models.CASCADE, related_name='get_event_participant', verbose_name='Календарь')
|
DictEmployee, on_delete=models.PROTECT, related_name="get_user_event", verbose_name="Участник"
|
||||||
|
)
|
||||||
|
event = models.ForeignKey(
|
||||||
|
Event, blank=True, null=True, on_delete=models.CASCADE, related_name="get_event_participant", verbose_name="Календарь"
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Участники события"
|
verbose_name = "Участники события"
|
||||||
@@ -118,9 +124,10 @@ class EventParticipant(models.Model):
|
|||||||
|
|
||||||
|
|
||||||
class ExclusionDates(models.Model):
|
class ExclusionDates(models.Model):
|
||||||
""" Таблица, которая содержит даты-исключения. То есть, все праздничные дни,
|
"""Таблица, которая содержит даты-исключения. То есть, все праздничные дни,
|
||||||
которые не попадают на выходные и все будни, которые праздничные """
|
которые не попадают на выходные и все будни, которые праздничные"""
|
||||||
exclusiondate = models.DateField(null=True, blank= True, verbose_name='Дата-исключение')
|
|
||||||
|
exclusiondate = models.DateField(null=True, blank=True, verbose_name="Дата-исключение")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Дата-исключение"
|
verbose_name = "Дата-исключение"
|
||||||
|
|||||||
Regular → Executable
+57
-56
@@ -1,47 +1,52 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from .models import *
|
|
||||||
from about_inspection.models import *
|
from about_inspection.models import *
|
||||||
from userauth.serializers import *
|
from userauth.serializers import *
|
||||||
|
|
||||||
|
from .models import *
|
||||||
|
|
||||||
|
|
||||||
class IdonlyRequieredSerializer(serializers.Serializer):
|
class IdonlyRequieredSerializer(serializers.Serializer):
|
||||||
id = serializers.IntegerField(required=False)
|
id = serializers.IntegerField(required=False)
|
||||||
|
|
||||||
|
|
||||||
class CalendarParticipantsSerializer(serializers.ModelSerializer):
|
class CalendarParticipantsSerializer(serializers.ModelSerializer):
|
||||||
""" Сериализатор участников календаря """
|
"""Сериализатор участников календаря"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CalendarParticipants
|
model = CalendarParticipants
|
||||||
exclude = ['calendar']
|
exclude = ["calendar"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class EventParticipantSerializer(serializers.ModelSerializer):
|
class EventParticipantSerializer(serializers.ModelSerializer):
|
||||||
""" Сериализатор участников календаря """
|
"""Сериализатор участников календаря"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CalendarParticipants
|
model = CalendarParticipants
|
||||||
exclude = ['event']
|
exclude = ["event"]
|
||||||
|
|
||||||
|
|
||||||
class EventParticipantSerializerIDonly(serializers.RelatedField):
|
class EventParticipantSerializerIDonly(serializers.RelatedField):
|
||||||
def to_representation(self, value):
|
def to_representation(self, value):
|
||||||
return value.participant.id
|
return value.participant.id
|
||||||
|
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
|
|
||||||
class CalendarEventSerializer(serializers.ModelSerializer):
|
class CalendarEventSerializer(serializers.ModelSerializer):
|
||||||
""" Сериализатор событий календаря """
|
"""Сериализатор событий календаря"""
|
||||||
|
|
||||||
# participant = EventParticipantSerializerIDonly(many=True, read_only=True, source='get_event_participant')
|
# participant = EventParticipantSerializerIDonly(many=True, read_only=True, source='get_event_participant')
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Event
|
model = Event
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CalendarsSerializer(serializers.ModelSerializer):
|
class CalendarsSerializer(serializers.ModelSerializer):
|
||||||
""" Сериализатор календарей """
|
"""Сериализатор календарей"""
|
||||||
|
|
||||||
events = CalendarEventSerializer(source="get_calendar_event", many=True, allow_null=True)
|
events = CalendarEventSerializer(source="get_calendar_event", many=True, allow_null=True)
|
||||||
participant = CalendarParticipantsSerializer(source="get_participants", many= True, read_only=True)
|
participant = CalendarParticipantsSerializer(source="get_participants", many=True, read_only=True)
|
||||||
|
|
||||||
|
|
||||||
# def is_editor(self, obj):
|
# def is_editor(self, obj):
|
||||||
# r = self.context.get("request")
|
# r = self.context.get("request")
|
||||||
@@ -49,87 +54,88 @@ class CalendarsSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Calendar
|
model = Calendar
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CalendarParticipantsSerializerFullInfo(serializers.ModelSerializer):
|
class CalendarParticipantsSerializerFullInfo(serializers.ModelSerializer):
|
||||||
def to_representation(self, value):
|
def to_representation(self, value):
|
||||||
return UserSerializerBase(value.participant_calendar).data
|
return UserSerializerBase(value.participant_calendar).data
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CalendarParticipants
|
model = CalendarParticipants
|
||||||
exclude = ['calendar']
|
exclude = ["calendar"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CalendarsSerializerForEventEdit(serializers.ModelSerializer):
|
class CalendarsSerializerForEventEdit(serializers.ModelSerializer):
|
||||||
""" Сериализатор календарей для окна редактирования событий"""
|
"""Сериализатор календарей для окна редактирования событий"""
|
||||||
|
|
||||||
|
|
||||||
participant = CalendarParticipantsSerializerFullInfo(source="get_participants", many= True, read_only=True)
|
|
||||||
|
|
||||||
|
participant = CalendarParticipantsSerializerFullInfo(source="get_participants", many=True, read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Calendar
|
model = Calendar
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
class EventFilesSerializer(serializers.ModelSerializer):
|
class EventFilesSerializer(serializers.ModelSerializer):
|
||||||
""" Сериализатор файлов календаря """
|
"""Сериализатор файлов календаря"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = EventFiles
|
model = EventFiles
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
class EventSerializerIdRequest(serializers.ModelSerializer):
|
class EventSerializerIdRequest(serializers.ModelSerializer):
|
||||||
participant = EventParticipantSerializerIDonly(source="get_event_participant", many= True, read_only=True)
|
participant = EventParticipantSerializerIDonly(source="get_event_participant", many=True, read_only=True)
|
||||||
files = EventFilesSerializer(many=True, source='get_calendar_event_files')
|
files = EventFilesSerializer(many=True, source="get_calendar_event_files")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Event
|
model = Event
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TableEventParticipantSerializer(serializers.ModelSerializer):
|
class TableEventParticipantSerializer(serializers.ModelSerializer):
|
||||||
""" Сериализатор участников календаря """
|
"""Сериализатор участников календаря"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = EventParticipant
|
model = EventParticipant
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
# Запрос сотрудников
|
# Запрос сотрудников
|
||||||
|
|
||||||
|
|
||||||
class EmployeeSerializer(serializers.ModelSerializer):
|
class EmployeeSerializer(serializers.ModelSerializer):
|
||||||
title = serializers.CharField(source='name')
|
title = serializers.CharField(source="name")
|
||||||
selected=serializers.BooleanField(default=False)
|
selected = serializers.BooleanField(default=False)
|
||||||
editor=serializers.BooleanField(default=False)
|
editor = serializers.BooleanField(default=False)
|
||||||
employees = serializers.SerializerMethodField('get_deps')
|
employees = serializers.SerializerMethodField("get_deps")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = DictDepartment
|
model = DictDepartment
|
||||||
fields = ["title","id","employees",'selected', 'editor']
|
fields = ["title", "id", "employees", "selected", "editor"]
|
||||||
|
|
||||||
def get_deps(self,obj):
|
def get_deps(self, obj):
|
||||||
|
|
||||||
return UsersSerializer(obj.dep_user.filter(deleted=0), many=True).data
|
return UsersSerializer(obj.dep_user.filter(deleted=0), many=True).data
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
class UserSerializerBase(serializers.ModelSerializer):
|
class UserSerializerBase(serializers.ModelSerializer):
|
||||||
title = serializers.CharField(source='fio')
|
title = serializers.CharField(source="fio")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = DictEmployee
|
model = DictEmployee
|
||||||
fields = ['title', "id" ]
|
fields = ["title", "id"]
|
||||||
|
|
||||||
|
|
||||||
class UsersSerializer(UserSerializerBase):
|
class UsersSerializer(UserSerializerBase):
|
||||||
editor=serializers.BooleanField(default=False)
|
editor = serializers.BooleanField(default=False)
|
||||||
selected=serializers.BooleanField(default=False)
|
selected = serializers.BooleanField(default=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = DictEmployee
|
model = DictEmployee
|
||||||
fields = ['title', "id", 'id_dict_department','selected','editor' ]
|
fields = ["title", "id", "id_dict_department", "selected", "editor"]
|
||||||
|
|
||||||
|
|
||||||
class DeleteCalendarSerializer(serializers.Serializer):
|
class DeleteCalendarSerializer(serializers.Serializer):
|
||||||
@@ -137,24 +143,19 @@ class DeleteCalendarSerializer(serializers.Serializer):
|
|||||||
|
|
||||||
|
|
||||||
class MyCalendarPostParametersParticipants(serializers.ModelSerializer):
|
class MyCalendarPostParametersParticipants(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
class Meta:
|
|
||||||
model = CalendarParticipants
|
model = CalendarParticipants
|
||||||
exclude = ['calendar','id']
|
exclude = ["calendar", "id"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MyCalendarPostParameters(serializers.ModelSerializer):
|
class MyCalendarPostParameters(serializers.ModelSerializer):
|
||||||
id=serializers.IntegerField(required=False)
|
id = serializers.IntegerField(required=False)
|
||||||
# author = serializers.IntegerField(required=False)
|
# author = serializers.IntegerField(required=False)
|
||||||
participant = MyCalendarPostParametersParticipants(source="get_participants", many=True, required=False)
|
participant = MyCalendarPostParametersParticipants(source="get_participants", many=True, required=False)
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Calendar
|
model = Calendar
|
||||||
exclude =['author']
|
exclude = ["author"]
|
||||||
|
|
||||||
|
|
||||||
class CreateUpdateEventSerializer(serializers.Serializer):
|
class CreateUpdateEventSerializer(serializers.Serializer):
|
||||||
|
|||||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
Regular → Executable
+4
-5
@@ -1,13 +1,12 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from rest_framework.routers import DefaultRouter
|
|
||||||
|
|
||||||
from .views import *
|
from .views import *
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# path('calendarEvents/', CalendarEventsAPIView.as_view(), name='calendarEvents'),
|
# path('calendarEvents/', CalendarEventsAPIView.as_view(), name='calendarEvents'),
|
||||||
path('get_employees/', GetEmployees.as_view(), name='get_employees'),
|
path("get_employees/", GetEmployees.as_view(), name="get_employees"),
|
||||||
path('my_calendars/', MyCalendars.as_view(), name='get_calendars'),
|
path("my_calendars/", MyCalendars.as_view(), name="get_calendars"),
|
||||||
path('exclusion_dates/', ExclusionDatesAPIView.as_view(), name='exclusion_dates'),
|
path("exclusion_dates/", ExclusionDatesAPIView.as_view(), name="exclusion_dates"),
|
||||||
path('my_events/', MyEvents.as_view(), name='myvents')
|
path("my_events/", MyEvents.as_view(), name="myvents"),
|
||||||
# path('createEvents/', CreateEventsAPIView.as_view(), name='createEvents')
|
# path('createEvents/', CreateEventsAPIView.as_view(), name='createEvents')
|
||||||
]
|
]
|
||||||
Regular → Executable
+107
-104
@@ -1,188 +1,192 @@
|
|||||||
from django.shortcuts import render
|
|
||||||
from .serializers import *
|
|
||||||
from .models import *
|
|
||||||
from rest_framework.views import APIView
|
|
||||||
from rest_framework.generics import ListAPIView
|
|
||||||
from rest_framework.response import Response
|
|
||||||
import json
|
import json
|
||||||
from django.db.models.functions import TruncYear
|
|
||||||
from django.db.models import Q
|
|
||||||
from drf_yasg.utils import swagger_auto_schema
|
|
||||||
from drf_yasg import openapi
|
|
||||||
from rest_framework.parsers import MultiPartParser
|
|
||||||
from rest_framework.parsers import JSONParser
|
|
||||||
from rest_framework.decorators import parser_classes
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from django.db.models import Q
|
||||||
|
from drf_yasg import openapi
|
||||||
|
from drf_yasg.utils import swagger_auto_schema
|
||||||
|
from rest_framework.parsers import MultiPartParser
|
||||||
|
from rest_framework.response import Response
|
||||||
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
|
from .models import *
|
||||||
|
from .serializers import *
|
||||||
|
|
||||||
|
|
||||||
class ExclusionDatesAPIView(APIView):
|
class ExclusionDatesAPIView(APIView):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
year = self.request.query_params.get('year', datetime.now().year)
|
year = self.request.query_params.get("year", datetime.now().year)
|
||||||
exclude = ExclusionDates.objects.filter(exclusiondate__year=year)
|
exclude = ExclusionDates.objects.filter(exclusiondate__year=year)
|
||||||
months = {}
|
months = {}
|
||||||
for i in range(1,13):
|
for i in range(1, 13):
|
||||||
months[i] = exclude.filter(exclusiondate__month=i).values_list("exclusiondate", flat=True)
|
months[i] = exclude.filter(exclusiondate__month=i).values_list("exclusiondate", flat=True)
|
||||||
return Response({year:months})
|
return Response({year: months})
|
||||||
|
|
||||||
|
|
||||||
class MyCalendars(APIView):
|
class MyCalendars(APIView):
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
calendars = Calendar.objects.filter(Q(get_participants__participant_calendar__id=request.user.user.id) | Q(author__id=request.user.user.id)).distinct()
|
calendars = Calendar.objects.filter(
|
||||||
return Response(CalendarsSerializer(calendars,many=True).data)
|
Q(get_participants__participant_calendar__id=request.user.user.id) | Q(author__id=request.user.user.id)
|
||||||
|
).distinct()
|
||||||
|
return Response(CalendarsSerializer(calendars, many=True).data)
|
||||||
|
|
||||||
@swagger_auto_schema(request_body=MyCalendarPostParameters)
|
@swagger_auto_schema(request_body=MyCalendarPostParameters)
|
||||||
def post(self,request):
|
def post(self, request):
|
||||||
'''
|
"""
|
||||||
Создание/редактирование календаря
|
Создание/редактирование календаря
|
||||||
если нет id = пойдет создавать календарь. В противном случае - на обновление
|
если нет id = пойдет создавать календарь. В противном случае - на обновление
|
||||||
|
|
||||||
|
|
||||||
'''
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
ob = MyCalendarPostParameters(data=request.data)
|
||||||
ob=MyCalendarPostParameters(data=request.data)
|
|
||||||
|
|
||||||
if ob.is_valid():
|
if ob.is_valid():
|
||||||
ob = ob.data
|
ob = ob.data
|
||||||
participant = ob['participant'] if 'participant' in ob else False
|
participant = ob["participant"] if "participant" in ob else False
|
||||||
|
|
||||||
del ob['participant']
|
del ob["participant"]
|
||||||
if 'id' in ob:
|
if "id" in ob:
|
||||||
newcal,created = Calendar.objects.update_or_create(id=ob['id'],defaults=ob)
|
newcal, created = Calendar.objects.update_or_create(id=ob["id"], defaults=ob)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
newcal=Calendar.objects.create(**ob, author=DictEmployee(id=request.user.user.id))
|
newcal = Calendar.objects.create(**ob, author=DictEmployee(id=request.user.user.id))
|
||||||
|
|
||||||
if participant != False:
|
if participant != False:
|
||||||
ptspnt = []
|
ptspnt = []
|
||||||
|
|
||||||
for x in participant:
|
for x in participant:
|
||||||
x['participant_calendar']=DictEmployee(id=x['participant_calendar'])
|
x["participant_calendar"] = DictEmployee(id=x["participant_calendar"])
|
||||||
|
|
||||||
newpart, created = CalendarParticipants.objects.update_or_create(calendar=newcal, participant_calendar=x['participant_calendar'],
|
newpart, created = CalendarParticipants.objects.update_or_create(
|
||||||
defaults=x)
|
calendar=newcal, participant_calendar=x["participant_calendar"], defaults=x
|
||||||
|
)
|
||||||
|
|
||||||
ptspnt.append(x['participant_calendar'])
|
ptspnt.append(x["participant_calendar"])
|
||||||
print(ptspnt)
|
print(ptspnt)
|
||||||
CalendarParticipants.objects.exclude(participant_calendar__in=ptspnt).filter(calendar=newcal).delete()
|
CalendarParticipants.objects.exclude(participant_calendar__in=ptspnt).filter(calendar=newcal).delete()
|
||||||
else:
|
else:
|
||||||
return Response({"mess":"Ошибка валидации полей"})
|
return Response({"mess": "Ошибка валидации полей"})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
return Response({"mess":"Ошибка операции"})
|
return Response({"mess": "Ошибка операции"})
|
||||||
|
|
||||||
return Response({"mess": f"Календарь успешно {'обновлен' if 'id' in ob else 'создан'}"})
|
return Response({"mess": f"Календарь успешно {'обновлен' if 'id' in ob else 'создан'}"})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@swagger_auto_schema(query_serializer=DeleteCalendarSerializer)
|
@swagger_auto_schema(query_serializer=DeleteCalendarSerializer)
|
||||||
def delete(self,request):
|
def delete(self, request):
|
||||||
try:
|
try:
|
||||||
Calendar.objects.get(id=request.query_params.get("delid")).delete()
|
Calendar.objects.get(id=request.query_params.get("delid")).delete()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
return Response({'mess':'Удаление не удалось'})
|
return Response({"mess": "Удаление не удалось"})
|
||||||
return Response({"mess": "Календарь удален"})
|
return Response({"mess": "Календарь удален"})
|
||||||
|
|
||||||
|
|
||||||
class GetEmployees(APIView):
|
class GetEmployees(APIView):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
|
||||||
queryset = DictDepartment.objects.filter(deleted=0,id__gt=0)
|
queryset = DictDepartment.objects.filter(deleted=0, id__gt=0)
|
||||||
|
|
||||||
return Response(EmployeeSerializer(queryset, many=True).data)
|
return Response(EmployeeSerializer(queryset, many=True).data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MyEvents(APIView):
|
class MyEvents(APIView):
|
||||||
parser_classes = [MultiPartParser]
|
parser_classes = [MultiPartParser]
|
||||||
|
|
||||||
@swagger_auto_schema(query_serializer=IdonlyRequieredSerializer)
|
@swagger_auto_schema(query_serializer=IdonlyRequieredSerializer)
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
allcalendars = Calendar.objects.filter(Q(get_participants__participant_calendar__id=request.user.user.id ,get_participants__editor=1) | Q(author__id=request.user.user.id)).distinct()
|
allcalendars = Calendar.objects.filter(
|
||||||
resp = {'mycalendars':CalendarsSerializerForEventEdit(allcalendars, many=True).data }
|
Q(get_participants__participant_calendar__id=request.user.user.id, get_participants__editor=1)
|
||||||
|
| Q(author__id=request.user.user.id)
|
||||||
|
).distinct()
|
||||||
|
resp = {"mycalendars": CalendarsSerializerForEventEdit(allcalendars, many=True).data}
|
||||||
if request.query_params.get("id") is not None:
|
if request.query_params.get("id") is not None:
|
||||||
event = Event.objects.get(id = request.query_params.get("id"))
|
event = Event.objects.get(id=request.query_params.get("id"))
|
||||||
resp['event']=EventSerializerIdRequest(event).data
|
resp["event"] = EventSerializerIdRequest(event).data
|
||||||
# events = Event.objects.filter(calendar__id = request.query_params.get("id"))
|
# events = Event.objects.filter(calendar__id = request.query_params.get("id"))
|
||||||
# resp['events'] = EventSerializerIdRequest(events, many=True).data
|
# resp['events'] = EventSerializerIdRequest(events, many=True).data
|
||||||
return Response(resp)
|
return Response(resp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@swagger_auto_schema(
|
@swagger_auto_schema(
|
||||||
request_body=CreateUpdateEventSerializer,
|
request_body=CreateUpdateEventSerializer,
|
||||||
manual_parameters=[
|
manual_parameters=[
|
||||||
|
openapi.Parameter(
|
||||||
openapi.Parameter('event', openapi.IN_FORM, type=openapi.TYPE_STRING, description='JSON', required=True,
|
"event",
|
||||||
),
|
openapi.IN_FORM,
|
||||||
openapi.Parameter('files', openapi.IN_FORM, type=openapi.TYPE_ARRAY, items=openapi.Items(type=openapi.TYPE_FILE), description='Документы'),])
|
type=openapi.TYPE_STRING,
|
||||||
|
description="JSON",
|
||||||
|
required=True,
|
||||||
|
),
|
||||||
|
openapi.Parameter(
|
||||||
|
"files",
|
||||||
|
openapi.IN_FORM,
|
||||||
|
type=openapi.TYPE_ARRAY,
|
||||||
|
items=openapi.Items(type=openapi.TYPE_FILE),
|
||||||
|
description="Документы",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
# @parser_classes([MultiPartParser])
|
# @parser_classes([MultiPartParser])
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
|
"""
|
||||||
|
К сожалению, у этого сваггера есть ограничения на несколько файлов, поэтому тут схемы для них не будет
|
||||||
|
Но мы будем отправлять ровно также
|
||||||
|
event = JSON строка
|
||||||
|
"id": 1, //не обязательно
|
||||||
|
"name": "2d1",
|
||||||
|
"date_start": "2024-05-28T16:10:41+03:00",
|
||||||
|
"date_end": "2024-06-06T16:10:43+03:00",
|
||||||
|
"period": JSON.stringify({"lll":'dkdjk'}),
|
||||||
|
"description": "ыуаыаы",
|
||||||
|
"calendar": 8,
|
||||||
|
'participant':[125,1],
|
||||||
|
'files':[объекты файлов, которые не будут удалены]
|
||||||
|
|
||||||
'''
|
'allday':boolean -добавлено 19072024
|
||||||
К сожалению, у этого сваггера есть ограничения на несколько файлов, поэтому тут схемы для них не будет
|
"""
|
||||||
Но мы будем отправлять ровно также
|
# event = json.dumps( {
|
||||||
event = JSON строка
|
# "id": 1,
|
||||||
"id": 1, //не обязательно
|
# "name": "2d1",
|
||||||
"name": "2d1",
|
# "date_start": "2024-05-28T16:10:41+03:00",
|
||||||
"date_start": "2024-05-28T16:10:41+03:00",
|
# "date_end": "2024-06-06T16:10:43+03:00",
|
||||||
"date_end": "2024-06-06T16:10:43+03:00",
|
# "period": json.dumps({"lll":'dkdjk'}),
|
||||||
"period": JSON.stringify({"lll":'dkdjk'}),
|
# "description": "<p>ыуаыаы</p>",
|
||||||
"description": "ыуаыаы",
|
# "calendar": 8,
|
||||||
"calendar": 8,
|
# 'participant':[1,125],
|
||||||
'participant':[125,1],
|
# 'files':[]
|
||||||
'files':[объекты файлов, которые не будут удалены]
|
# })
|
||||||
|
created = True
|
||||||
'allday':boolean -добавлено 19072024
|
|
||||||
'''
|
|
||||||
# event = json.dumps( {
|
|
||||||
# "id": 1,
|
|
||||||
# "name": "2d1",
|
|
||||||
# "date_start": "2024-05-28T16:10:41+03:00",
|
|
||||||
# "date_end": "2024-06-06T16:10:43+03:00",
|
|
||||||
# "period": json.dumps({"lll":'dkdjk'}),
|
|
||||||
# "description": "<p>ыуаыаы</p>",
|
|
||||||
# "calendar": 8,
|
|
||||||
# 'participant':[1,125],
|
|
||||||
# 'files':[]
|
|
||||||
# })
|
|
||||||
created=True
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
event = json.loads(request.data['event'])
|
event = json.loads(request.data["event"])
|
||||||
# event = json.loads(event)
|
# event = json.loads(event)
|
||||||
|
|
||||||
filesadd = request.FILES.getlist('files')
|
filesadd = request.FILES.getlist("files")
|
||||||
|
|
||||||
# participant=request.POST['participant']
|
# participant=request.POST['participant']
|
||||||
participant= event['participant']
|
participant = event["participant"]
|
||||||
|
|
||||||
|
event["calendar"] = Calendar(id=event["calendar"])
|
||||||
|
|
||||||
|
files = [x["id"] for x in event["files"]]
|
||||||
|
|
||||||
event['calendar']=Calendar(id=event['calendar'])
|
del event["files"]
|
||||||
|
del event["participant"]
|
||||||
|
|
||||||
files = [x['id'] for x in event['files']]
|
evnt = None
|
||||||
|
if "id" in event:
|
||||||
del event['files']
|
evnt, created = Event.objects.update_or_create(id=event["id"], defaults=event)
|
||||||
del event['participant']
|
|
||||||
|
|
||||||
|
|
||||||
evnt=None
|
|
||||||
if 'id' in event:
|
|
||||||
evnt,created=Event.objects.update_or_create(id=event['id'], defaults = event)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
evnt=Event.objects.create(**event)
|
evnt = Event.objects.create(**event)
|
||||||
|
|
||||||
|
|
||||||
for x in participant:
|
for x in participant:
|
||||||
EventParticipant.objects.update_or_create(event=evnt,participant=DictEmployee(id=x))
|
EventParticipant.objects.update_or_create(event=evnt, participant=DictEmployee(id=x))
|
||||||
|
|
||||||
EventParticipant.objects.filter(event=evnt).exclude(participant__id__in=participant).delete()
|
EventParticipant.objects.filter(event=evnt).exclude(participant__id__in=participant).delete()
|
||||||
|
|
||||||
|
|
||||||
delfiles = EventFiles.objects.filter(event=evnt).exclude(id__in=files)
|
delfiles = EventFiles.objects.filter(event=evnt).exclude(id__in=files)
|
||||||
|
|
||||||
for x in delfiles:
|
for x in delfiles:
|
||||||
@@ -193,18 +197,17 @@ class MyEvents(APIView):
|
|||||||
delfiles.delete()
|
delfiles.delete()
|
||||||
|
|
||||||
for x in filesadd:
|
for x in filesadd:
|
||||||
EventFiles.objects.create(event=evnt,file=x)
|
EventFiles.objects.create(event=evnt, file=x)
|
||||||
|
|
||||||
|
return Response({"mess": f"Событие {'создано' if created == True else 'обновлено'}"})
|
||||||
return Response({'mess':f'Событие {"создано" if created==True else "обновлено"}'})
|
|
||||||
except Exception:
|
except Exception:
|
||||||
return Response({'mess':f'Произошла ошибка'})
|
return Response({"mess": "Произошла ошибка"})
|
||||||
|
|
||||||
@swagger_auto_schema(query_serializer=DeleteCalendarSerializer)
|
@swagger_auto_schema(query_serializer=DeleteCalendarSerializer)
|
||||||
def delete(self,request):
|
def delete(self, request):
|
||||||
try:
|
try:
|
||||||
Event.objects.get(id=request.query_params.get("delid")).delete()
|
Event.objects.get(id=request.query_params.get("delid")).delete()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
return Response({'mess':'Удаление не удалось'})
|
return Response({"mess": "Удаление не удалось"})
|
||||||
return Response({"mess": "Событие удалено "})
|
return Response({"mess": "Событие удалено "})
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
+31
-15
@@ -1,6 +1,9 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import *
|
|
||||||
from userauth.models import DictEmployee
|
from userauth.models import DictEmployee
|
||||||
|
|
||||||
|
from .models import *
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
||||||
|
|
||||||
@@ -9,21 +12,32 @@ from userauth.models import DictEmployee
|
|||||||
|
|
||||||
# class DictEmployeeAdmin(admin.ModelAdmin):
|
# class DictEmployeeAdmin(admin.ModelAdmin):
|
||||||
class IlineComitteeFiles(admin.StackedInline):
|
class IlineComitteeFiles(admin.StackedInline):
|
||||||
|
fields = (
|
||||||
fields = ('file_name','is_actual',)
|
"file_name",
|
||||||
|
"is_actual",
|
||||||
|
)
|
||||||
model = Committee1Files
|
model = Committee1Files
|
||||||
extra = 0
|
extra = 0
|
||||||
|
|
||||||
|
|
||||||
class InlineComiteePeople(admin.StackedInline):
|
class InlineComiteePeople(admin.StackedInline):
|
||||||
model = Committee2
|
model = Committee2
|
||||||
extra = 0
|
extra = 0
|
||||||
|
|
||||||
|
|
||||||
class Committee1Admin(admin.ModelAdmin):
|
class Committee1Admin(admin.ModelAdmin):
|
||||||
readonly_fields = ['id']
|
readonly_fields = ["id"]
|
||||||
list_display = ( 'num_start', 'name',)
|
list_display = (
|
||||||
search_fields = ('num_start', 'name',)
|
"num_start",
|
||||||
|
"name",
|
||||||
|
)
|
||||||
|
search_fields = (
|
||||||
|
"num_start",
|
||||||
|
"name",
|
||||||
|
)
|
||||||
inlines = [IlineComitteeFiles, InlineComiteePeople]
|
inlines = [IlineComitteeFiles, InlineComiteePeople]
|
||||||
|
|
||||||
|
|
||||||
class InlineRespFiles(admin.StackedInline):
|
class InlineRespFiles(admin.StackedInline):
|
||||||
model = OrderResponsibilityFiles
|
model = OrderResponsibilityFiles
|
||||||
extra = 0
|
extra = 0
|
||||||
@@ -31,20 +45,22 @@ class InlineRespFiles(admin.StackedInline):
|
|||||||
|
|
||||||
class InlineRespEmp(admin.StackedInline):
|
class InlineRespEmp(admin.StackedInline):
|
||||||
model = OrderResponsibilityEmployee
|
model = OrderResponsibilityEmployee
|
||||||
extra=0
|
extra = 0
|
||||||
|
|
||||||
def formfield_for_foreignkey(self, db_field, request, **kwargs):
|
def formfield_for_foreignkey(self, db_field, request, **kwargs):
|
||||||
if db_field.name == 'employee':
|
if db_field.name == "employee":
|
||||||
kwargs['queryset'] = DictEmployee.objects.filter(deleted=0)
|
kwargs["queryset"] = DictEmployee.objects.filter(deleted=0)
|
||||||
return super().formfield_for_foreignkey(db_field, request, **kwargs)
|
return super().formfield_for_foreignkey(db_field, request, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class OrderResponsibilityAdmin(admin.ModelAdmin):
|
class OrderResponsibilityAdmin(admin.ModelAdmin):
|
||||||
# model= OrderResponsibility
|
# model= OrderResponsibility
|
||||||
list_display = ( 'number', 'name')
|
list_display = ("number", "name")
|
||||||
search_fields = ('number', 'name',)
|
search_fields = (
|
||||||
inlines=[InlineRespFiles,InlineRespEmp]
|
"number",
|
||||||
|
"name",
|
||||||
|
)
|
||||||
|
inlines = [InlineRespFiles, InlineRespEmp]
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Committee1, Committee1Admin)
|
admin.site.register(Committee1, Committee1Admin)
|
||||||
|
|||||||
Regular → Executable
+3
-3
@@ -2,6 +2,6 @@ from django.apps import AppConfig
|
|||||||
|
|
||||||
|
|
||||||
class CommeterespConfig(AppConfig):
|
class CommeterespConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
name = 'commeteresp'
|
name = "commeteresp"
|
||||||
verbose_name = 'Ответственность и комиссии'
|
verbose_name = "Ответственность и комиссии"
|
||||||
Regular → Executable
+110
-86
@@ -4,154 +4,178 @@ from django.db import migrations, models
|
|||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = []
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Committee1',
|
name="Committee1",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.PositiveIntegerField(primary_key=True, serialize=False)),
|
("id", models.PositiveIntegerField(primary_key=True, serialize=False)),
|
||||||
('name', models.CharField(blank=True, db_comment='═ршьхэютрэшх ъюьшёёшш', max_length=1000, null=True, verbose_name='Название')),
|
(
|
||||||
('num_start', models.CharField(blank=True, db_comment='═юьхЁ яЁшърчр ю ёючфрэшш ъюьшёёшш', max_length=100, null=True)),
|
"name",
|
||||||
('date_start', models.DateField(blank=True, db_comment='─рЄр яЁшърчр ю ёючфрэшш ъюьшёёшш', null=True)),
|
models.CharField(
|
||||||
('num_finish', models.CharField(blank=True, db_comment='═юьхЁ яЁшърчр юс єяЁрчфэхэшш ъюьшёёшш', max_length=100, null=True)),
|
blank=True, db_comment="═ршьхэютрэшх ъюьшёёшш", max_length=1000, null=True, verbose_name="Название"
|
||||||
('date_finish', models.DateField(blank=True, db_comment='─рЄр єяЁрчфэхэш\xa0 ъюьшёёшш', null=True)),
|
),
|
||||||
('comment', models.CharField(blank=True, db_comment='╧Ёшьхўрэшх', max_length=4000, null=True)),
|
),
|
||||||
|
(
|
||||||
|
"num_start",
|
||||||
|
models.CharField(blank=True, db_comment="═юьхЁ яЁшърчр ю ёючфрэшш ъюьшёёшш", max_length=100, null=True),
|
||||||
|
),
|
||||||
|
("date_start", models.DateField(blank=True, db_comment="─рЄр яЁшърчр ю ёючфрэшш ъюьшёёшш", null=True)),
|
||||||
|
(
|
||||||
|
"num_finish",
|
||||||
|
models.CharField(blank=True, db_comment="═юьхЁ яЁшърчр юс єяЁрчфэхэшш ъюьшёёшш", max_length=100, null=True),
|
||||||
|
),
|
||||||
|
("date_finish", models.DateField(blank=True, db_comment="─рЄр єяЁрчфэхэш\xa0 ъюьшёёшш", null=True)),
|
||||||
|
("comment", models.CharField(blank=True, db_comment="╧Ёшьхўрэшх", max_length=4000, null=True)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Комиссия',
|
"verbose_name": "Комиссия",
|
||||||
'verbose_name_plural': 'Комиссии',
|
"verbose_name_plural": "Комиссии",
|
||||||
'db_table': 'committee1',
|
"db_table": "committee1",
|
||||||
'db_table_comment': '╤яшёюъ ъюьшёёшщ',
|
"db_table_comment": "╤яшёюъ ъюьшёёшщ",
|
||||||
'managed': False,
|
"managed": False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Committee1Files',
|
name="Committee1Files",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.PositiveIntegerField(primary_key=True, serialize=False)),
|
("id", models.PositiveIntegerField(primary_key=True, serialize=False)),
|
||||||
('file_name', models.FileField(blank=True, null=True, upload_to='comitee_files')),
|
("file_name", models.FileField(blank=True, null=True, upload_to="comitee_files")),
|
||||||
('is_actual', models.IntegerField(db_comment='╧Ёшчэръ ръЄєры№эюёЄш Їрщыр', verbose_name='Актуальность')),
|
("is_actual", models.IntegerField(db_comment="╧Ёшчэръ ръЄєры№эюёЄш Їрщыр", verbose_name="Актуальность")),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Файл',
|
"verbose_name": "Файл",
|
||||||
'verbose_name_plural': 'Файлы',
|
"verbose_name_plural": "Файлы",
|
||||||
'db_table': 'committee1_files',
|
"db_table": "committee1_files",
|
||||||
'managed': False,
|
"managed": False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Committee2',
|
name="Committee2",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Участник',
|
"verbose_name": "Участник",
|
||||||
'verbose_name_plural': 'Участники',
|
"verbose_name_plural": "Участники",
|
||||||
'db_table': 'committee2',
|
"db_table": "committee2",
|
||||||
'db_table_comment': '╤юёЄрт ъюьшёёшщ',
|
"db_table_comment": "╤юёЄрт ъюьшёёшщ",
|
||||||
'managed': False,
|
"managed": False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='DictCommitteeExpert',
|
name="DictCommitteeExpert",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('fio', models.CharField(blank=True, db_comment='╘╚╬ ¤ъёяхЁЄр', max_length=250, null=True)),
|
("fio", models.CharField(blank=True, db_comment="╘╚╬ ¤ъёяхЁЄр", max_length=250, null=True)),
|
||||||
('tel', models.CharField(blank=True, db_comment='╥хыхЇюэ', max_length=100, null=True)),
|
("tel", models.CharField(blank=True, db_comment="╥хыхЇюэ", max_length=100, null=True)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'db_table': 'dict_committee_expert',
|
"db_table": "dict_committee_expert",
|
||||||
'db_table_comment': '╤яЁртюўэшъ эхчртшёшь√ї ¤ъёяхЁЄют',
|
"db_table_comment": "╤яЁртюўэшъ эхчртшёшь√ї ¤ъёяхЁЄют",
|
||||||
'managed': False,
|
"managed": False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='DictCommitteeOrderAddon',
|
name="DictCommitteeOrderAddon",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('number', models.CharField(db_comment='═юьхЁ шчьхэхэшщ ъ яЁшърчє ю ъюьшёёшш', max_length=100)),
|
("number", models.CharField(db_comment="═юьхЁ шчьхэхэшщ ъ яЁшърчє ю ъюьшёёшш", max_length=100)),
|
||||||
('date', models.DateField(db_comment='─рЄр шчьхэхэшщ т яЁшърч ю ъюьшёёшш')),
|
("date", models.DateField(db_comment="─рЄр шчьхэхэшщ т яЁшърч ю ъюьшёёшш")),
|
||||||
('name', models.CharField(blank=True, db_comment='═ршьхэютрэшх шчьхэхэшщ ъ яЁшърчє ю ъюьшёёшш', max_length=1024, null=True)),
|
(
|
||||||
('text', models.TextField(blank=True, db_comment='╥хъёЄ шчьхэхэшщ т яЁшърч ю ъюьшёёшш', null=True)),
|
"name",
|
||||||
|
models.CharField(
|
||||||
|
blank=True, db_comment="═ршьхэютрэшх шчьхэхэшщ ъ яЁшърчє ю ъюьшёёшш", max_length=1024, null=True
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("text", models.TextField(blank=True, db_comment="╥хъёЄ шчьхэхэшщ т яЁшърч ю ъюьшёёшш", null=True)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'db_table': 'dict_committee_order_addon',
|
"db_table": "dict_committee_order_addon",
|
||||||
'db_table_comment': '╥рсышЎр фюяюыэхэшщ ъ яЁшърчє ю ъюьшёёшш',
|
"db_table_comment": "╥рсышЎр фюяюыэхэшщ ъ яЁшърчє ю ъюьшёёшш",
|
||||||
'managed': False,
|
"managed": False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='DictCommitteePosition',
|
name="DictCommitteePosition",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('name', models.CharField(blank=True, db_comment='эршьхэютрэшх фюцэюёЄш т ъюьшёёшш', max_length=100, null=True)),
|
("name", models.CharField(blank=True, db_comment="эршьхэютрэшх фюцэюёЄш т ъюьшёёшш", max_length=100, null=True)),
|
||||||
('name_short', models.CharField(blank=True, db_comment='ъЁрЄъюх эршьхэютрэшх фюцэюёЄш т ъюьшёёшш', max_length=100, null=True)),
|
(
|
||||||
('ord', models.IntegerField(blank=True, db_comment='╧юЁ\xa0фюъ ёюЁЄшЁютъш', null=True)),
|
"name_short",
|
||||||
|
models.CharField(
|
||||||
|
blank=True, db_comment="ъЁрЄъюх эршьхэютрэшх фюцэюёЄш т ъюьшёёшш", max_length=100, null=True
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("ord", models.IntegerField(blank=True, db_comment="╧юЁ\xa0фюъ ёюЁЄшЁютъш", null=True)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'db_table': 'dict_committee_position',
|
"db_table": "dict_committee_position",
|
||||||
'db_table_comment': '╤яЁртюўэшъ фюыцэюёЄхщ ъюьшёёшщ',
|
"db_table_comment": "╤яЁртюўэшъ фюыцэюёЄхщ ъюьшёёшщ",
|
||||||
'managed': False,
|
"managed": False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='DictCommitteeType',
|
name="DictCommitteeType",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||||
('name', models.CharField(blank=True, db_comment='═ршьхэютрэшх тшфр ъюьшёёшш', max_length=100, null=True)),
|
("name", models.CharField(blank=True, db_comment="═ршьхэютрэшх тшфр ъюьшёёшш", max_length=100, null=True)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'db_table': 'dict_committee_type',
|
"db_table": "dict_committee_type",
|
||||||
'db_table_comment': '╤яЁртюўэшъ тшфют ъюьшёёшщ',
|
"db_table_comment": "╤яЁртюўэшъ тшфют ъюьшёёшщ",
|
||||||
'managed': False,
|
"managed": False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='OrderResponsibility',
|
name="OrderResponsibility",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.PositiveIntegerField(db_comment='╥рсхы№э√щ эюьхЁ', primary_key=True, serialize=False)),
|
("id", models.PositiveIntegerField(db_comment="╥рсхы№э√щ эюьхЁ", primary_key=True, serialize=False)),
|
||||||
('number', models.CharField(db_comment='═юьхЁ яЁшърчр', max_length=50)),
|
("number", models.CharField(db_comment="═юьхЁ яЁшърчр", max_length=50)),
|
||||||
('date', models.DateField(db_comment='─рЄр яЁшърчр')),
|
("date", models.DateField(db_comment="─рЄр яЁшърчр")),
|
||||||
('name', models.CharField(db_comment='═рчтрэшх яЁшърчр', max_length=1024)),
|
("name", models.CharField(db_comment="═рчтрэшх яЁшърчр", max_length=1024)),
|
||||||
('sphere_of_responsibility', models.CharField(db_comment='╤ЇхЁр юЄтхЄёЄтхээюёЄш ёюЄЁєфэшъют, эрчэрўрхьр\xa0 фрээ√ь яЁшърчюь', max_length=1024)),
|
(
|
||||||
|
"sphere_of_responsibility",
|
||||||
|
models.CharField(
|
||||||
|
db_comment="╤ЇхЁр юЄтхЄёЄтхээюёЄш ёюЄЁєфэшъют, эрчэрўрхьр\xa0 фрээ√ь яЁшърчюь", max_length=1024
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Cфера ответственности',
|
"verbose_name": "Cфера ответственности",
|
||||||
'verbose_name_plural': 'Сферы ответстсвенности',
|
"verbose_name_plural": "Сферы ответстсвенности",
|
||||||
'db_table': 'order_responsibility',
|
"db_table": "order_responsibility",
|
||||||
'db_table_comment': '╥рсышЎр яЁшърчют ю эрчэрўхэшш юЄтхЄёЄтхээ√ї ёюЄЁєфэшъют',
|
"db_table_comment": "╥рсышЎр яЁшърчют ю эрчэрўхэшш юЄтхЄёЄтхээ√ї ёюЄЁєфэшъют",
|
||||||
'managed': False,
|
"managed": False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='OrderResponsibilityEmployee',
|
name="OrderResponsibilityEmployee",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.PositiveIntegerField(db_comment='╥рсхы№э√щ эюьхЁ', primary_key=True, serialize=False)),
|
("id", models.PositiveIntegerField(db_comment="╥рсхы№э√щ эюьхЁ", primary_key=True, serialize=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Ответственный сотрудник',
|
"verbose_name": "Ответственный сотрудник",
|
||||||
'verbose_name_plural': 'Ответственные сотрудники',
|
"verbose_name_plural": "Ответственные сотрудники",
|
||||||
'db_table': 'order_responsibility_employee',
|
"db_table": "order_responsibility_employee",
|
||||||
'managed': False,
|
"managed": False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='OrderResponsibilityFiles',
|
name="OrderResponsibilityFiles",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.PositiveIntegerField(db_comment='╥рсхы№э√щ эюьхЁ', primary_key=True, serialize=False)),
|
("id", models.PositiveIntegerField(db_comment="╥рсхы№э√щ эюьхЁ", primary_key=True, serialize=False)),
|
||||||
('file_name', models.FileField(blank=True, null=True, upload_to='resp_files')),
|
("file_name", models.FileField(blank=True, null=True, upload_to="resp_files")),
|
||||||
('is_actual', models.IntegerField(db_comment='╧Ёшчэръ ръЄєры№эюёЄш Їрщыр')),
|
("is_actual", models.IntegerField(db_comment="╧Ёшчэръ ръЄєры№эюёЄш Їрщыр")),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'Файл сферы ответственности',
|
"verbose_name": "Файл сферы ответственности",
|
||||||
'verbose_name_plural': 'Файлы сферы ответственности',
|
"verbose_name_plural": "Файлы сферы ответственности",
|
||||||
'db_table': 'order_responsibility_files',
|
"db_table": "order_responsibility_files",
|
||||||
'managed': False,
|
"managed": False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
+148
-75
@@ -1,160 +1,233 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class Committee1(models.Model):
|
class Committee1(models.Model):
|
||||||
id= models.PositiveIntegerField(primary_key=True)
|
id = models.PositiveIntegerField(primary_key=True)
|
||||||
name = models.CharField(max_length=1000, blank=True, null=True, db_comment='═ршьхэютрэшх ъюьшёёшш',verbose_name = 'Название')
|
name = models.CharField(max_length=1000, blank=True, null=True, db_comment="═ршьхэютрэшх ъюьшёёшш", verbose_name="Название")
|
||||||
num_start = models.CharField(max_length=100, blank=True, null=True, db_comment='═юьхЁ яЁшърчр ю ёючфрэшш ъюьшёёшш')
|
num_start = models.CharField(max_length=100, blank=True, null=True, db_comment="═юьхЁ яЁшърчр ю ёючфрэшш ъюьшёёшш")
|
||||||
date_start = models.DateField(blank=True, null=True, db_comment='─рЄр яЁшърчр ю ёючфрэшш ъюьшёёшш')
|
date_start = models.DateField(blank=True, null=True, db_comment="─рЄр яЁшърчр ю ёючфрэшш ъюьшёёшш")
|
||||||
num_finish = models.CharField(max_length=100, blank=True, null=True, db_comment='═юьхЁ яЁшърчр юс єяЁрчфэхэшш ъюьшёёшш')
|
num_finish = models.CharField(max_length=100, blank=True, null=True, db_comment="═юьхЁ яЁшърчр юс єяЁрчфэхэшш ъюьшёёшш")
|
||||||
date_finish = models.DateField(blank=True, null=True, db_comment='─рЄр єяЁрчфэхэш ъюьшёёшш')
|
date_finish = models.DateField(blank=True, null=True, db_comment="─рЄр єяЁрчфэхэш ъюьшёёшш")
|
||||||
comment = models.CharField(max_length=4000, blank=True, null=True, db_comment='╧Ёшьхўрэшх')
|
comment = models.CharField(max_length=4000, blank=True, null=True, db_comment="╧Ёшьхўрэшх")
|
||||||
id_dict_committee_type = models.ForeignKey('DictCommitteeType', models.DO_NOTHING, db_column='id_dict_committee_type', db_comment='╙эшъры№э√щ эюьхЁ тшфр ъюьшёёшш',verbose_name = 'Тип')
|
id_dict_committee_type = models.ForeignKey(
|
||||||
id_master = models.ForeignKey('self', models.DO_NOTHING, db_column='id_master', blank=True, null=True, db_comment='╙═ т√°хёЄю ∙хщ ъюьшёёшш',verbose_name = 'Комиссия-родитель')
|
"DictCommitteeType",
|
||||||
|
models.DO_NOTHING,
|
||||||
|
db_column="id_dict_committee_type",
|
||||||
|
db_comment="╙эшъры№э√щ эюьхЁ тшфр ъюьшёёшш",
|
||||||
|
verbose_name="Тип",
|
||||||
|
)
|
||||||
|
id_master = models.ForeignKey(
|
||||||
|
"self",
|
||||||
|
models.DO_NOTHING,
|
||||||
|
db_column="id_master",
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
db_comment="╙═ т√°хёЄю ∙хщ ъюьшёёшш",
|
||||||
|
verbose_name="Комиссия-родитель",
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'committee1'
|
db_table = "committee1"
|
||||||
db_table_comment = '╤яшёюъ ъюьшёёшщ'
|
db_table_comment = "╤яшёюъ ъюьшёёшщ"
|
||||||
verbose_name = 'Комиссия'
|
verbose_name = "Комиссия"
|
||||||
verbose_name_plural = 'Комиссии'
|
verbose_name_plural = "Комиссии"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.name)
|
return str(self.name)
|
||||||
|
|
||||||
|
|
||||||
class Committee1Files(models.Model):
|
class Committee1Files(models.Model):
|
||||||
id= models.PositiveIntegerField(primary_key=True)
|
id = models.PositiveIntegerField(primary_key=True)
|
||||||
id_committee1 = models.ForeignKey(Committee1, models.DO_NOTHING, db_column='id_committee1', db_comment='╚─ ъюьшёёшш',related_name='comitee_files')
|
id_committee1 = models.ForeignKey(
|
||||||
file_name = models.FileField(null=True, blank=True, upload_to='comitee_files')
|
Committee1, models.DO_NOTHING, db_column="id_committee1", db_comment="╚─ ъюьшёёшш", related_name="comitee_files"
|
||||||
|
)
|
||||||
|
file_name = models.FileField(null=True, blank=True, upload_to="comitee_files")
|
||||||
# file_name = models.CharField(max_length=1024, db_comment='╚ь Їрщыр')
|
# file_name = models.CharField(max_length=1024, db_comment='╚ь Їрщыр')
|
||||||
is_actual = models.IntegerField(db_comment='╧Ёшчэръ ръЄєры№эюёЄш Їрщыр',verbose_name = 'Актуальность')
|
is_actual = models.IntegerField(db_comment="╧Ёшчэръ ръЄєры№эюёЄш Їрщыр", verbose_name="Актуальность")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'committee1_files'
|
db_table = "committee1_files"
|
||||||
verbose_name = 'Файл'
|
verbose_name = "Файл"
|
||||||
verbose_name_plural = 'Файлы'
|
verbose_name_plural = "Файлы"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.file_name)
|
return str(self.file_name)
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class Committee2(models.Model):
|
class Committee2(models.Model):
|
||||||
id_committee1 = models.ForeignKey(Committee1, models.DO_NOTHING, db_column='id_committee1', db_comment='╙эшъры№э√щ эюьхЁ ъюьшёёшш', related_name='com_members')
|
id_committee1 = models.ForeignKey(
|
||||||
committee_position = models.ForeignKey('DictCommitteePosition', models.DO_NOTHING, db_column='id_dict_committee_position', db_comment='╙эшъры№э√щ эюьхЁ фюцэюёЄш т ъюьшёёшш',verbose_name = 'Роль')
|
Committee1,
|
||||||
employee = models.ForeignKey('userauth.DictEmployee', models.DO_NOTHING, db_column='id_dict_employee', blank=True, null=True, db_comment='╚─ ёюЄЁєфэшър', related_name="user_committe2",verbose_name = 'Участник')
|
models.DO_NOTHING,
|
||||||
committee_expert = models.ForeignKey('DictCommitteeExpert', models.DO_NOTHING, db_column='id_dict_committee_expert', blank=True, null=True, db_comment='╙эшъры№э√щ эюьхЁ ¤ъёяхЁЄр')
|
db_column="id_committee1",
|
||||||
|
db_comment="╙эшъры№э√щ эюьхЁ ъюьшёёшш",
|
||||||
|
related_name="com_members",
|
||||||
|
)
|
||||||
|
committee_position = models.ForeignKey(
|
||||||
|
"DictCommitteePosition",
|
||||||
|
models.DO_NOTHING,
|
||||||
|
db_column="id_dict_committee_position",
|
||||||
|
db_comment="╙эшъры№э√щ эюьхЁ фюцэюёЄш т ъюьшёёшш",
|
||||||
|
verbose_name="Роль",
|
||||||
|
)
|
||||||
|
employee = models.ForeignKey(
|
||||||
|
"userauth.DictEmployee",
|
||||||
|
models.DO_NOTHING,
|
||||||
|
db_column="id_dict_employee",
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
db_comment="╚─ ёюЄЁєфэшър",
|
||||||
|
related_name="user_committe2",
|
||||||
|
verbose_name="Участник",
|
||||||
|
)
|
||||||
|
committee_expert = models.ForeignKey(
|
||||||
|
"DictCommitteeExpert",
|
||||||
|
models.DO_NOTHING,
|
||||||
|
db_column="id_dict_committee_expert",
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
db_comment="╙эшъры№э√щ эюьхЁ ¤ъёяхЁЄр",
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'committee2'
|
db_table = "committee2"
|
||||||
db_table_comment = '╤юёЄрт ъюьшёёшщ'
|
db_table_comment = "╤юёЄрт ъюьшёёшщ"
|
||||||
verbose_name = 'Участник'
|
verbose_name = "Участник"
|
||||||
verbose_name_plural = 'Участники'
|
verbose_name_plural = "Участники"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.committee_position.name)
|
return str(self.committee_position.name)
|
||||||
|
|
||||||
|
|
||||||
class DictCommitteeExpert(models.Model):
|
class DictCommitteeExpert(models.Model):
|
||||||
fio = models.CharField(max_length=250, blank=True, null=True, db_comment='╘╚╬ ¤ъёяхЁЄр')
|
fio = models.CharField(max_length=250, blank=True, null=True, db_comment="╘╚╬ ¤ъёяхЁЄр")
|
||||||
tel = models.CharField(max_length=100, blank=True, null=True, db_comment='╥хыхЇюэ')
|
tel = models.CharField(max_length=100, blank=True, null=True, db_comment="╥хыхЇюэ")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'dict_committee_expert'
|
db_table = "dict_committee_expert"
|
||||||
db_table_comment = '╤яЁртюўэшъ эхчртшёшь√ї ¤ъёяхЁЄют'
|
db_table_comment = "╤яЁртюўэшъ эхчртшёшь√ї ¤ъёяхЁЄют"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.fio)
|
return str(self.fio)
|
||||||
|
|
||||||
|
|
||||||
class DictCommitteeOrderAddon(models.Model):
|
class DictCommitteeOrderAddon(models.Model):
|
||||||
id_committee1 = models.ForeignKey(Committee1, models.DO_NOTHING, db_column='id_committee1', db_comment='╚─ ъюьшёёшш, т яЁшърчх яю ъюЄюЁющ яЁюшчю°ыш шчьхэхэш ')
|
id_committee1 = models.ForeignKey(
|
||||||
number = models.CharField(max_length=100, db_comment='═юьхЁ шчьхэхэшщ ъ яЁшърчє ю ъюьшёёшш')
|
Committee1,
|
||||||
date = models.DateField(db_comment='─рЄр шчьхэхэшщ т яЁшърч ю ъюьшёёшш')
|
models.DO_NOTHING,
|
||||||
name = models.CharField(max_length=1024, blank=True, null=True, db_comment='═ршьхэютрэшх шчьхэхэшщ ъ яЁшърчє ю ъюьшёёшш')
|
db_column="id_committee1",
|
||||||
text = models.TextField(blank=True, null=True, db_comment='╥хъёЄ шчьхэхэшщ т яЁшърч ю ъюьшёёшш')
|
db_comment="╚─ ъюьшёёшш, т яЁшърчх яю ъюЄюЁющ яЁюшчю°ыш шчьхэхэш ",
|
||||||
|
)
|
||||||
|
number = models.CharField(max_length=100, db_comment="═юьхЁ шчьхэхэшщ ъ яЁшърчє ю ъюьшёёшш")
|
||||||
|
date = models.DateField(db_comment="─рЄр шчьхэхэшщ т яЁшърч ю ъюьшёёшш")
|
||||||
|
name = models.CharField(max_length=1024, blank=True, null=True, db_comment="═ршьхэютрэшх шчьхэхэшщ ъ яЁшърчє ю ъюьшёёшш")
|
||||||
|
text = models.TextField(blank=True, null=True, db_comment="╥хъёЄ шчьхэхэшщ т яЁшърч ю ъюьшёёшш")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'dict_committee_order_addon'
|
db_table = "dict_committee_order_addon"
|
||||||
db_table_comment = '╥рсышЎр фюяюыэхэшщ ъ яЁшърчє ю ъюьшёёшш'
|
db_table_comment = "╥рсышЎр фюяюыэхэшщ ъ яЁшърчє ю ъюьшёёшш"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DictCommitteePosition(models.Model):
|
class DictCommitteePosition(models.Model):
|
||||||
name = models.CharField(max_length=100, blank=True, null=True, db_comment='эршьхэютрэшх фюцэюёЄш т ъюьшёёшш')
|
name = models.CharField(max_length=100, blank=True, null=True, db_comment="эршьхэютрэшх фюцэюёЄш т ъюьшёёшш")
|
||||||
name_short = models.CharField(max_length=100, blank=True, null=True, db_comment='ъЁрЄъюх эршьхэютрэшх фюцэюёЄш т ъюьшёёшш')
|
name_short = models.CharField(max_length=100, blank=True, null=True, db_comment="ъЁрЄъюх эршьхэютрэшх фюцэюёЄш т ъюьшёёшш")
|
||||||
ord = models.IntegerField(blank=True, null=True, db_comment='╧юЁ фюъ ёюЁЄшЁютъш')
|
ord = models.IntegerField(blank=True, null=True, db_comment="╧юЁ фюъ ёюЁЄшЁютъш")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'dict_committee_position'
|
db_table = "dict_committee_position"
|
||||||
db_table_comment = '╤яЁртюўэшъ фюыцэюёЄхщ ъюьшёёшщ'
|
db_table_comment = "╤яЁртюўэшъ фюыцэюёЄхщ ъюьшёёшщ"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.name_short)
|
return str(self.name_short)
|
||||||
|
|
||||||
|
|
||||||
class DictCommitteeType(models.Model):
|
class DictCommitteeType(models.Model):
|
||||||
name = models.CharField(max_length=100, blank=True, null=True, db_comment='═ршьхэютрэшх тшфр ъюьшёёшш')
|
name = models.CharField(max_length=100, blank=True, null=True, db_comment="═ршьхэютрэшх тшфр ъюьшёёшш")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'dict_committee_type'
|
db_table = "dict_committee_type"
|
||||||
db_table_comment = '╤яЁртюўэшъ тшфют ъюьшёёшщ'
|
db_table_comment = "╤яЁртюўэшъ тшфют ъюьшёёшщ"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.name)
|
return str(self.name)
|
||||||
|
|
||||||
|
|
||||||
class OrderResponsibility(models.Model):
|
class OrderResponsibility(models.Model):
|
||||||
id = models.PositiveIntegerField(primary_key=True, db_comment='╥рсхы№э√щ эюьхЁ')
|
id = models.PositiveIntegerField(primary_key=True, db_comment="╥рсхы№э√щ эюьхЁ")
|
||||||
number = models.CharField(max_length=50, db_comment='═юьхЁ яЁшърчр')
|
number = models.CharField(max_length=50, db_comment="═юьхЁ яЁшърчр")
|
||||||
date = models.DateField(db_comment='─рЄр яЁшърчр')
|
date = models.DateField(db_comment="─рЄр яЁшърчр")
|
||||||
name = models.CharField(max_length=1024, db_comment='═рчтрэшх яЁшърчр')
|
name = models.CharField(max_length=1024, db_comment="═рчтрэшх яЁшърчр")
|
||||||
sphere_of_responsibility = models.CharField(max_length=1024, db_comment='╤ЇхЁр юЄтхЄёЄтхээюёЄш ёюЄЁєфэшъют, эрчэрўрхьр фрээ√ь яЁшърчюь')
|
sphere_of_responsibility = models.CharField(
|
||||||
|
max_length=1024, db_comment="╤ЇхЁр юЄтхЄёЄтхээюёЄш ёюЄЁєфэшъют, эрчэрўрхьр фрээ√ь яЁшърчюь"
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'order_responsibility'
|
db_table = "order_responsibility"
|
||||||
db_table_comment = '╥рсышЎр яЁшърчют ю эрчэрўхэшш юЄтхЄёЄтхээ√ї ёюЄЁєфэшъют'
|
db_table_comment = "╥рсышЎр яЁшърчют ю эрчэрўхэшш юЄтхЄёЄтхээ√ї ёюЄЁєфэшъют"
|
||||||
verbose_name = 'Cфера ответственности'
|
verbose_name = "Cфера ответственности"
|
||||||
verbose_name_plural = 'Сферы ответстсвенности'
|
verbose_name_plural = "Сферы ответстсвенности"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.number} - {self.name}'
|
return f"{self.number} - {self.name}"
|
||||||
|
|
||||||
|
|
||||||
class OrderResponsibilityEmployee(models.Model):
|
class OrderResponsibilityEmployee(models.Model):
|
||||||
id = models.PositiveIntegerField(primary_key=True, db_comment='╥рсхы№э√щ эюьхЁ')
|
id = models.PositiveIntegerField(primary_key=True, db_comment="╥рсхы№э√щ эюьхЁ")
|
||||||
id_order_responsibility = models.OneToOneField(OrderResponsibility, models.DO_NOTHING, db_column='id_order_responsibility', db_comment='╚─ яЁшърчр ю эрчэрўхэшш юЄтхЄёЄтхээ√ї ёюЄЁєфэшъют',related_name="respons_users") # The composite primary key (id_order_responsibility, id_dict_employee) found, that is not supported. The first column is selected.
|
id_order_responsibility = models.OneToOneField(
|
||||||
employee = models.ForeignKey('userauth.DictEmployee', models.DO_NOTHING, db_column='id_dict_employee', db_comment='╚─ ёюЄЁєфэшър, ъюЄюЁ√щ эрчэрўхэ юЄтхЄёЄтхээ√ь яю фрээюьє яЁшърчє', related_name="user_respons")
|
OrderResponsibility,
|
||||||
|
models.DO_NOTHING,
|
||||||
|
db_column="id_order_responsibility",
|
||||||
|
db_comment="╚─ яЁшърчр ю эрчэрўхэшш юЄтхЄёЄтхээ√ї ёюЄЁєфэшъют",
|
||||||
|
related_name="respons_users",
|
||||||
|
) # The composite primary key (id_order_responsibility, id_dict_employee) found, that is not supported. The first column is selected.
|
||||||
|
employee = models.ForeignKey(
|
||||||
|
"userauth.DictEmployee",
|
||||||
|
models.DO_NOTHING,
|
||||||
|
db_column="id_dict_employee",
|
||||||
|
db_comment="╚─ ёюЄЁєфэшър, ъюЄюЁ√щ эрчэрўхэ юЄтхЄёЄтхээ√ь яю фрээюьє яЁшърчє",
|
||||||
|
related_name="user_respons",
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'order_responsibility_employee'
|
db_table = "order_responsibility_employee"
|
||||||
unique_together = (('id_order_responsibility', 'employee'),)
|
unique_together = (("id_order_responsibility", "employee"),)
|
||||||
verbose_name = 'Ответственный сотрудник'
|
verbose_name = "Ответственный сотрудник"
|
||||||
verbose_name_plural = 'Ответственные сотрудники'
|
verbose_name_plural = "Ответственные сотрудники"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.employee)
|
return str(self.employee)
|
||||||
|
|
||||||
|
|
||||||
class OrderResponsibilityFiles(models.Model):
|
class OrderResponsibilityFiles(models.Model):
|
||||||
id = models.PositiveIntegerField(primary_key=True, db_comment='╥рсхы№э√щ эюьхЁ')
|
id = models.PositiveIntegerField(primary_key=True, db_comment="╥рсхы№э√щ эюьхЁ")
|
||||||
id_order_responsibility = models.ForeignKey(OrderResponsibility, models.DO_NOTHING, db_column='id_order_responsibility', db_comment='╚─ яЁшърчр юс юЄтхЄёЄтхээ√ї ёюЄЁєфэшърї', related_name="get_resp_files")
|
id_order_responsibility = models.ForeignKey(
|
||||||
file_name = models.FileField(null=True, blank=True, upload_to='resp_files')
|
OrderResponsibility,
|
||||||
is_actual = models.IntegerField(db_comment='╧Ёшчэръ ръЄєры№эюёЄш Їрщыр')
|
models.DO_NOTHING,
|
||||||
|
db_column="id_order_responsibility",
|
||||||
|
db_comment="╚─ яЁшърчр юс юЄтхЄёЄтхээ√ї ёюЄЁєфэшърї",
|
||||||
|
related_name="get_resp_files",
|
||||||
|
)
|
||||||
|
file_name = models.FileField(null=True, blank=True, upload_to="resp_files")
|
||||||
|
is_actual = models.IntegerField(db_comment="╧Ёшчэръ ръЄєры№эюёЄш Їрщыр")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'order_responsibility_files'
|
db_table = "order_responsibility_files"
|
||||||
verbose_name = 'Файл сферы ответственности'
|
verbose_name = "Файл сферы ответственности"
|
||||||
verbose_name_plural = 'Файлы сферы ответственности'
|
verbose_name_plural = "Файлы сферы ответственности"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.file_name}'
|
return f"{self.file_name}"
|
||||||
Regular → Executable
+12
-7
@@ -1,13 +1,18 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from django.db.models import Count
|
|
||||||
from .models import *
|
from .models import *
|
||||||
|
|
||||||
|
|
||||||
class DictCommitteePositionSerializer(serializers.ModelSerializer):
|
class DictCommitteePositionSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = DictCommitteePosition
|
model = DictCommitteePosition
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
DictCommitteeExpert
|
DictCommitteeExpert
|
||||||
|
|
||||||
|
|
||||||
class DictCommitteeExpertSerializer(serializers.ModelSerializer):
|
class DictCommitteeExpertSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = DictCommitteeExpert
|
model = DictCommitteeExpert
|
||||||
fields = '__all__'
|
fields = "__all__"
|
||||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
|||||||
from django.shortcuts import render
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
+15
-18
@@ -1,42 +1,39 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import *
|
|
||||||
from django.db.models import Avg
|
from django.db.models import Avg
|
||||||
|
|
||||||
class BaseCriteriaAdmin(admin.ModelAdmin):
|
from .models import *
|
||||||
list_display=('name', 'rating')
|
|
||||||
|
|
||||||
|
|
||||||
|
class BaseCriteriaAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("name", "rating")
|
||||||
|
|
||||||
|
|
||||||
class RatingStatusInline(admin.TabularInline):
|
class RatingStatusInline(admin.TabularInline):
|
||||||
model = RatingStatus
|
model = RatingStatus
|
||||||
fields = ( 'crit', 'rating')
|
fields = ("crit", "rating")
|
||||||
readonly_fields=( 'crit', 'rating')
|
readonly_fields = ("crit", "rating")
|
||||||
can_delete = False
|
can_delete = False
|
||||||
show_change_link = False
|
show_change_link = False
|
||||||
extra = 0
|
extra = 0
|
||||||
|
|
||||||
class UserCommentAdmin(admin.ModelAdmin):
|
|
||||||
fields = ( 'comment', ('get_rat', 'names', 'time_create'))
|
|
||||||
list_display=('names', 'comment', 'get_rat', 'utility')
|
|
||||||
readonly_fields=('names', 'time_create', 'comment', 'get_rat')
|
|
||||||
list_filter=('time_create', 'utility')
|
|
||||||
list_editable=('utility', )
|
|
||||||
|
|
||||||
|
class UserCommentAdmin(admin.ModelAdmin):
|
||||||
|
fields = ("comment", ("get_rat", "names", "time_create"))
|
||||||
|
list_display = ("names", "comment", "get_rat", "utility")
|
||||||
|
readonly_fields = ("names", "time_create", "comment", "get_rat")
|
||||||
|
list_filter = ("time_create", "utility")
|
||||||
|
list_editable = ("utility",)
|
||||||
|
|
||||||
def get_rat(self, obj):
|
def get_rat(self, obj):
|
||||||
ratavg = obj.get_rating.aggregate(res=Avg('rating'))
|
ratavg = obj.get_rating.aggregate(res=Avg("rating"))
|
||||||
|
|
||||||
return int(ratavg['res']) if float(ratavg['res']).is_integer() else round(ratavg['res'], 1)
|
return int(ratavg["res"]) if float(ratavg["res"]).is_integer() else round(ratavg["res"], 1)
|
||||||
|
|
||||||
|
get_rat.short_description = "Средняя оценка"
|
||||||
|
|
||||||
get_rat.short_description="Средняя оценка"
|
|
||||||
|
|
||||||
inlines = [RatingStatusInline]
|
inlines = [RatingStatusInline]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# class RatingStatusAdmin(admin.ModelAdmin):
|
# class RatingStatusAdmin(admin.ModelAdmin):
|
||||||
# # inlines = [RatingStatusInline]
|
# # inlines = [RatingStatusInline]
|
||||||
# fields = ('get_name','get_login', ('crit', 'rating'), 'usercom', 'get_time')
|
# fields = ('get_name','get_login', ('crit', 'rating'), 'usercom', 'get_time')
|
||||||
|
|||||||
Regular → Executable
+2
-2
@@ -2,6 +2,6 @@ from django.apps import AppConfig
|
|||||||
|
|
||||||
|
|
||||||
class FeedbackConfig(AppConfig):
|
class FeedbackConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
name = 'feedback'
|
name = "feedback"
|
||||||
verbose_name = "Обратная связь"
|
verbose_name = "Обратная связь"
|
||||||
Regular → Executable
+30
-23
@@ -1,30 +1,39 @@
|
|||||||
from django.db import models
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
from userauth.models import DictEmployee
|
from userauth.models import DictEmployee
|
||||||
|
|
||||||
class BaseCriteria(models.Model):
|
|
||||||
name = models.CharField(verbose_name='Название', max_length=150, blank=True, db_index=True)
|
|
||||||
ico = models.CharField(verbose_name='Иконка', max_length=150, null=True, blank=True)
|
|
||||||
rating = models.IntegerField(verbose_name='Рейтинг', default=5, blank=True)
|
|
||||||
color = models.CharField(verbose_name='Цвет иконки', max_length=150, null=True, blank=True)
|
|
||||||
class Meta:
|
|
||||||
|
|
||||||
verbose_name = "Справочник - Критерии оценки"
|
class BaseCriteria(models.Model):
|
||||||
verbose_name_plural = "Справочник - Критерии оценки"
|
name = models.CharField(verbose_name="Название", max_length=150, blank=True, db_index=True)
|
||||||
|
ico = models.CharField(verbose_name="Иконка", max_length=150, null=True, blank=True)
|
||||||
|
rating = models.IntegerField(verbose_name="Рейтинг", default=5, blank=True)
|
||||||
|
color = models.CharField(verbose_name="Цвет иконки", max_length=150, null=True, blank=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = "Справочник - Критерии оценки"
|
||||||
|
verbose_name_plural = "Справочник - Критерии оценки"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.name)
|
return str(self.name)
|
||||||
|
|
||||||
|
|
||||||
# Первичная модель
|
# Первичная модель
|
||||||
class UserComment(models.Model):
|
class UserComment(models.Model):
|
||||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, related_name='get_userauth', verbose_name='Пользователь')
|
user = models.ForeignKey(
|
||||||
time_create = models.DateTimeField(auto_now_add = True, verbose_name='Время создания')
|
settings.AUTH_USER_MODEL,
|
||||||
comment = models.TextField(null=True, verbose_name='Комментарий')
|
editable=False,
|
||||||
utility = models.BooleanField(default=True, verbose_name='Полезность')
|
on_delete=models.PROTECT,
|
||||||
|
related_name="get_userauth",
|
||||||
|
verbose_name="Пользователь",
|
||||||
|
)
|
||||||
|
time_create = models.DateTimeField(auto_now_add=True, verbose_name="Время создания")
|
||||||
|
comment = models.TextField(null=True, verbose_name="Комментарий")
|
||||||
|
utility = models.BooleanField(default=True, verbose_name="Полезность")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
verbose_name = "Комментарий пользователя"
|
||||||
verbose_name = "Комментарий пользователя"
|
verbose_name_plural = "Комментарии пользователя"
|
||||||
verbose_name_plural = "Комментарии пользователя"
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.user.fio())
|
return str(self.user.fio())
|
||||||
@@ -32,20 +41,18 @@ class UserComment(models.Model):
|
|||||||
def names(self):
|
def names(self):
|
||||||
return DictEmployee.objects.get(login=self.user)
|
return DictEmployee.objects.get(login=self.user)
|
||||||
|
|
||||||
names.short_description="ФИО"
|
names.short_description = "ФИО"
|
||||||
|
|
||||||
|
|
||||||
# Дочерняя модель
|
# Дочерняя модель
|
||||||
class RatingStatus(models.Model):
|
class RatingStatus(models.Model):
|
||||||
crit = models.ForeignKey(BaseCriteria, on_delete=models.PROTECT, related_name='get_criteria', verbose_name='Критерий')
|
crit = models.ForeignKey(BaseCriteria, on_delete=models.PROTECT, related_name="get_criteria", verbose_name="Критерий")
|
||||||
rating = models.FloatField(verbose_name='Рейтинг')
|
rating = models.FloatField(verbose_name="Рейтинг")
|
||||||
usercom = models.ForeignKey(UserComment, on_delete=models.PROTECT, related_name='get_rating', verbose_name='Комментарий')
|
usercom = models.ForeignKey(UserComment, on_delete=models.PROTECT, related_name="get_rating", verbose_name="Комментарий")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
verbose_name = "Рейтинг"
|
verbose_name = "Рейтинг"
|
||||||
verbose_name_plural = "Рейтинги"
|
verbose_name_plural = "Рейтинги"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.crit)
|
return str(self.crit)
|
||||||
|
|
||||||
|
|
||||||
Regular → Executable
+38
-30
@@ -1,44 +1,52 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from .models import *
|
|
||||||
from userauth.serializers import *
|
from userauth.serializers import *
|
||||||
|
|
||||||
|
from .models import *
|
||||||
|
|
||||||
|
|
||||||
class BaseCriteriaAllSerializer(serializers.ModelSerializer):
|
class BaseCriteriaAllSerializer(serializers.ModelSerializer):
|
||||||
""" Забирает все поля из модели по хранению названия критерия оценки,
|
"""Забирает все поля из модели по хранению названия критерия оценки,
|
||||||
используемой иконки, рейтинга по умолчанию, и цвет для иконки
|
используемой иконки, рейтинга по умолчанию, и цвет для иконки
|
||||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||||
"""
|
"""
|
||||||
class Meta:
|
|
||||||
model = BaseCriteria
|
class Meta:
|
||||||
fields = '__all__'
|
model = BaseCriteria
|
||||||
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
class RatingStatusSerializer(serializers.ModelSerializer):
|
class RatingStatusSerializer(serializers.ModelSerializer):
|
||||||
""" Забирает все поля из модели по хранению критерия оценки,
|
"""Забирает все поля из модели по хранению критерия оценки,
|
||||||
какую поставили по критерию, и к какому коментарию оно относится
|
какую поставили по критерию, и к какому коментарию оно относится
|
||||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||||
"""
|
"""
|
||||||
class Meta:
|
|
||||||
model = RatingStatus
|
class Meta:
|
||||||
fields ='__all__'
|
model = RatingStatus
|
||||||
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
class FeedbackUserCommentSerializer(serializers.ModelSerializer):
|
class FeedbackUserCommentSerializer(serializers.ModelSerializer):
|
||||||
""" Забирает все поля из модели, без расшифровки пользователя
|
"""Забирает все поля из модели, без расшифровки пользователя
|
||||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||||
"""
|
"""
|
||||||
class Meta:
|
|
||||||
model = UserComment
|
class Meta:
|
||||||
fields = '__all__'
|
model = UserComment
|
||||||
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
class UserCommentSerializer(serializers.ModelSerializer):
|
class UserCommentSerializer(serializers.ModelSerializer):
|
||||||
"""Используется в представлении DataForStatisticsAPIView, для сбора информации
|
"""Используется в представлении DataForStatisticsAPIView, для сбора информации
|
||||||
feed - берет все поля из модели с UserComment, и добавляет информацию об авторе
|
feed - берет все поля из модели с UserComment, и добавляет информацию об авторе
|
||||||
"""
|
"""
|
||||||
author = serializers.SerializerMethodField('get_user')
|
|
||||||
class Meta:
|
|
||||||
model = UserComment
|
|
||||||
fields = '__all__'
|
|
||||||
|
|
||||||
def get_user(self, obj):
|
author = serializers.SerializerMethodField("get_user")
|
||||||
return InfoUserCardSerializer(obj.user.user).data
|
|
||||||
|
class Meta:
|
||||||
|
model = UserComment
|
||||||
|
fields = "__all__"
|
||||||
|
|
||||||
|
def get_user(self, obj):
|
||||||
|
return InfoUserCardSerializer(obj.user.user).data
|
||||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
Regular → Executable
+2
-4
@@ -1,9 +1,7 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from .views import *
|
from .views import *
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('feedbackdata/', FeedbackAPIView.as_view(), name='feedbackdata'),
|
path("feedbackdata/", FeedbackAPIView.as_view(), name="feedbackdata"),
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
Regular → Executable
+30
-41
@@ -1,44 +1,45 @@
|
|||||||
from rest_framework.response import Response
|
|
||||||
import datetime
|
import datetime
|
||||||
from .serializers import *
|
|
||||||
from .models import *
|
|
||||||
|
|
||||||
|
from rest_framework.response import Response
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
|
from .models import *
|
||||||
|
from .serializers import *
|
||||||
|
|
||||||
|
|
||||||
class FeedbackAPIView(APIView):
|
class FeedbackAPIView(APIView):
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
"""Оценка сайта. Собираем информацию о критериях оценки, поставленный рейтинг и коментарий"""
|
"""Оценка сайта. Собираем информацию о критериях оценки, поставленный рейтинг и коментарий"""
|
||||||
|
|
||||||
nowrating = RatingStatus.objects.filter(usercom__user_id=self.request.user.id,
|
nowrating = RatingStatus.objects.filter(
|
||||||
usercom__time_create__contains=datetime.date.today()
|
usercom__user_id=self.request.user.id, usercom__time_create__contains=datetime.date.today()
|
||||||
).order_by("crit_id")
|
).order_by("crit_id")
|
||||||
nowcomment = UserComment.objects.filter(user_id=self.request.user.id,
|
nowcomment = UserComment.objects.filter(user_id=self.request.user.id, time_create__contains=datetime.date.today())
|
||||||
time_create__contains=datetime.date.today()
|
|
||||||
)
|
|
||||||
basecrit = BaseCriteria.objects.all()
|
basecrit = BaseCriteria.objects.all()
|
||||||
|
|
||||||
# Сериализуем извлечённый набор записей
|
# Сериализуем извлечённый набор записей
|
||||||
serializer_for_basecrit = BaseCriteriaAllSerializer(
|
serializer_for_basecrit = BaseCriteriaAllSerializer(
|
||||||
instance=basecrit, # Передаём набор записей
|
instance=basecrit, # Передаём набор записей
|
||||||
many=True # Указываем, что на вход подаётся именно набор записей
|
many=True, # Указываем, что на вход подаётся именно набор записей
|
||||||
)
|
)
|
||||||
|
|
||||||
serializer_for_nowcomment = FeedbackUserCommentSerializer(
|
serializer_for_nowcomment = FeedbackUserCommentSerializer(
|
||||||
instance=nowcomment, # Передаём набор записей
|
instance=nowcomment, # Передаём набор записей
|
||||||
many=True # Указываем, что на вход подаётся именно набор записей
|
many=True, # Указываем, что на вход подаётся именно набор записей
|
||||||
)
|
)
|
||||||
|
|
||||||
serializer_for_nowrating = RatingStatusSerializer(
|
serializer_for_nowrating = RatingStatusSerializer(
|
||||||
instance=nowrating, # Передаём набор записей , "rat":serializer_for_queryset2.data
|
instance=nowrating, # Передаём набор записей , "rat":serializer_for_queryset2.data
|
||||||
many=True # Указываем, что на вход подаётся именно набор записей
|
many=True, # Указываем, что на вход подаётся именно набор записей
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response({"basecrit": serializer_for_basecrit.data,
|
return Response(
|
||||||
"nowrating": serializer_for_nowrating.data,
|
{
|
||||||
"nowcomment": serializer_for_nowcomment.data[0] if len(nowcomment)>0 else None
|
"basecrit": serializer_for_basecrit.data,
|
||||||
})
|
"nowrating": serializer_for_nowrating.data,
|
||||||
|
"nowcomment": serializer_for_nowcomment.data[0] if len(nowcomment) > 0 else None,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
"""Оценка сайта. И добавление или обновление комементария или оценки сайта
|
"""Оценка сайта. И добавление или обновление комементария или оценки сайта
|
||||||
@@ -46,25 +47,13 @@ class FeedbackAPIView(APIView):
|
|||||||
nowrating - массив объектов nowrating {id: 34, rating: 3, crit: 1, usercom: 13}
|
nowrating - массив объектов nowrating {id: 34, rating: 3, crit: 1, usercom: 13}
|
||||||
объект nowcomment {id: 13, time_create: '2024-03-18T13:38:41.421851+03:00', comment: '', utility: true, user: 22}
|
объект nowcomment {id: 13, time_create: '2024-03-18T13:38:41.421851+03:00', comment: '', utility: true, user: 22}
|
||||||
"""
|
"""
|
||||||
comment, created = UserComment.objects.update_or_create(id = request.data['nowcomment']['id'],
|
comment, created = UserComment.objects.update_or_create(
|
||||||
user_id = self.request.user.id,
|
id=request.data["nowcomment"]["id"],
|
||||||
defaults = {'comment':request.data['nowcomment']['comment'],
|
user_id=self.request.user.id,
|
||||||
'time_create':datetime.datetime.now()
|
defaults={"comment": request.data["nowcomment"]["comment"], "time_create": datetime.datetime.now()},
|
||||||
})
|
)
|
||||||
for x in request.data['nowrating']:
|
for x in request.data["nowrating"]:
|
||||||
RatingStatus.objects.update_or_create(id=x['id'],
|
RatingStatus.objects.update_or_create(
|
||||||
defaults={'rating':x['rating'],
|
id=x["id"], defaults={"rating": x["rating"], "crit_id": x["crit"], "usercom_id": comment.id}
|
||||||
'crit_id':x['crit'],
|
)
|
||||||
'usercom_id':comment.id
|
|
||||||
})
|
|
||||||
return Response({})
|
return Response({})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
-1
@@ -1,4 +1,3 @@
|
|||||||
from django.contrib import admin
|
|
||||||
from .models import *
|
from .models import *
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
+2
-2
@@ -2,5 +2,5 @@ from django.apps import AppConfig
|
|||||||
|
|
||||||
|
|
||||||
class GarbageConfig(AppConfig):
|
class GarbageConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
name = 'garbage'
|
name = "garbage"
|
||||||
Regular → Executable
+4
-5
@@ -8,17 +8,16 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Carousels(models.Model):
|
class Carousels(models.Model):
|
||||||
title = models.CharField(max_length=255)
|
title = models.CharField(max_length=255)
|
||||||
text = models.TextField(blank=True, null=True)
|
text = models.TextField(blank=True, null=True)
|
||||||
link = models.ImageField(upload_to='fns/%Y/%m/%d', default="newsimage/default.jpg", null=True, verbose_name='Картинка')
|
link = models.ImageField(upload_to="fns/%Y/%m/%d", default="newsimage/default.jpg", null=True, verbose_name="Картинка")
|
||||||
order = models.IntegerField(blank=True, null=True)
|
order = models.IntegerField(blank=True, null=True)
|
||||||
link2 = models.ImageField(upload_to='fns/%Y/%m/%d', null=True, verbose_name='Картинка2')
|
link2 = models.ImageField(upload_to="fns/%Y/%m/%d", null=True, verbose_name="Картинка2")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'carousels'
|
db_table = "carousels"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.title)
|
return str(self.title)
|
||||||
Regular → Executable
+4
-6
@@ -1,11 +1,9 @@
|
|||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from .models import *
|
from .models import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CarouselsSerializer(serializers.ModelSerializer):
|
class CarouselsSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
model = Carousels
|
||||||
model = Carousels
|
fields = "__all__"
|
||||||
fields = '__all__'
|
|
||||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
Regular → Executable
+2
-12
@@ -1,17 +1,7 @@
|
|||||||
from django.urls import include, path
|
from django.urls import path
|
||||||
from rest_framework.routers import DefaultRouter
|
|
||||||
|
|
||||||
from .views import *
|
from .views import *
|
||||||
|
|
||||||
from rest_framework_simplejwt.views import (
|
|
||||||
TokenObtainPairView,
|
|
||||||
TokenRefreshView,TokenVerifyView
|
|
||||||
)
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
path("links/", CaorusAPIView.as_view(), name="CaorusAPIView"),
|
||||||
|
|
||||||
path('links/', CaorusAPIView.as_view(), name='CaorusAPIView'),
|
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
Regular → Executable
+5
-3
@@ -1,11 +1,13 @@
|
|||||||
from django.shortcuts import render
|
|
||||||
from rest_framework.generics import ListAPIView
|
from rest_framework.generics import ListAPIView
|
||||||
from .models import *
|
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
|
||||||
|
from .models import *
|
||||||
from .serializers import *
|
from .serializers import *
|
||||||
|
|
||||||
|
|
||||||
class CaorusAPIView(ListAPIView):
|
class CaorusAPIView(ListAPIView):
|
||||||
"""Карусель с произвольным набором картинок"""
|
"""Карусель с произвольным набором картинок"""
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
queryset = Carousels.objects.using('add_base').all().order_by('order')
|
queryset = Carousels.objects.using("add_base").all().order_by("order")
|
||||||
return Response(CarouselsSerializer(queryset, many=True).data)
|
return Response(CarouselsSerializer(queryset, many=True).data)
|
||||||
Regular → Executable
File mode changed.
Regular → Executable
+14
-8
@@ -1,22 +1,28 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from .models import *
|
from .models import *
|
||||||
|
|
||||||
|
|
||||||
class GeneralVacationAdmin(admin.ModelAdmin):
|
class GeneralVacationAdmin(admin.ModelAdmin):
|
||||||
fields = ('login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period')
|
fields = ("login", "planned_date", "count_days", "type_of_vacation", "start_work_period", "end_work_period")
|
||||||
list_display=('get_name', 'login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period')
|
list_display = ("get_name", "login", "planned_date", "count_days", "type_of_vacation", "start_work_period", "end_work_period")
|
||||||
readonly_fields=('get_name',)
|
readonly_fields = ("get_name",)
|
||||||
|
|
||||||
def get_name(self, obj):
|
def get_name(self, obj):
|
||||||
|
|
||||||
return obj.user.fio()
|
return obj.user.fio()
|
||||||
|
|
||||||
|
|
||||||
class PlanCalendarAdmin(admin.ModelAdmin):
|
class PlanCalendarAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'start_work_period', 'end_work_period')
|
list_display = ("name", "start_work_period", "end_work_period")
|
||||||
list_filter = ('start_work_period', 'end_work_period')
|
list_filter = ("start_work_period", "end_work_period")
|
||||||
fields = ('name', 'start_work_period', 'end_work_period')
|
fields = ("name", "start_work_period", "end_work_period")
|
||||||
|
|
||||||
|
|
||||||
class BasePositionAmin(admin.ModelAdmin):
|
class BasePositionAmin(admin.ModelAdmin):
|
||||||
list_display = ('id', 'name', 'order')
|
list_display = ("id", "name", "order")
|
||||||
list_editable = ('order', 'name')
|
list_editable = ("order", "name")
|
||||||
|
|
||||||
|
|
||||||
# admin.site.register(GeneralVacation, GeneralVacationAdmin),
|
# admin.site.register(GeneralVacation, GeneralVacationAdmin),
|
||||||
admin.site.register(PlanCalendar, PlanCalendarAdmin)
|
admin.site.register(PlanCalendar, PlanCalendarAdmin)
|
||||||
|
|||||||
Regular → Executable
+2
-3
@@ -2,7 +2,6 @@ from django.apps import AppConfig
|
|||||||
|
|
||||||
|
|
||||||
class GeneralVacationConfig(AppConfig):
|
class GeneralVacationConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
name = 'general_vacation'
|
name = "general_vacation"
|
||||||
verbose_name = "Общий график отпусков"
|
verbose_name = "Общий график отпусков"
|
||||||
|
|
||||||
Loaded 100 of 389 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user