chore [P-0]: сhore
This commit is contained in:
1 parent
d13d02fadb
commit
2e48e08b83
389 files changed
+17779
-11492
No files matched your search
Regular → Executable
File mode changed.
@@ -49,14 +49,14 @@ BACKEND_INTERNAL_PORT=8000
|
||||
|
||||
DOCKER_RESTART="unless-stopped"
|
||||
|
||||
DOCS_EXTERNAL_PORT=5173
|
||||
DOCS_INTERNAL_PORT=5173
|
||||
|
||||
NGINX_EXTERNAL_PORT=80
|
||||
NGINX_INTERNAL_PORT=80
|
||||
|
||||
RUN_WITH_DOCS=False
|
||||
PRODUCTION=True
|
||||
|
||||
APT_PROXY='172.16.200.28:3142'
|
||||
PIP_INDEX_URL='pip.oktp'
|
||||
NPM_REGISTRY="https://npm.oktp/"
|
||||
MYDEBUG=False
|
||||
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"
|
||||
Regular → Executable
-3
@@ -1,6 +1,3 @@
|
||||
RUN_WITH_DOCS=False
|
||||
|
||||
AUTO_BACKEND=False
|
||||
|
||||
DB_NAME="accounting"
|
||||
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
|
||||
easydockersave
|
||||
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() {
|
||||
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
|
||||
@@ -29,7 +29,8 @@ cp -n ${PROJECT_DIR}/.env.local.sample ${PROJECT_DIR}/.env.local
|
||||
if [[ -f .env.local ]]; then
|
||||
source ".env.local"
|
||||
fi
|
||||
|
||||
REAL_UID=${SUDO_UID:-$(id -u)}
|
||||
REAL_GID=${SUDO_GID:-$(id -g)}
|
||||
# Создаем директорию с локальными фойлами
|
||||
mkdir -p "${LOCAL_FILES_DIR}"
|
||||
|
||||
@@ -95,20 +96,21 @@ mkdir -p "${LOCAL_FILES_DIR}/front/"
|
||||
export NGINX_EXTERNAL_PORT=${NGINX_EXTERNAL_PORT}
|
||||
export BACKEND_EXTERNAL_PORT=${BACKEND_EXTERNAL_PORT}
|
||||
export FRONTEND_EXTERNAL_PORT=${FRONTEND_EXTERNAL_PORT}
|
||||
export DOCS_EXTERNAL_PORT=${DOCS_EXTERNAL_PORT}
|
||||
|
||||
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
|
||||
# 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" > \
|
||||
"${LOCAL_FILES_DIR}/nginx/conf/nginx.prod.conf"
|
||||
# # Следующие команды заполняют шаблон значениями переменных окружения
|
||||
# else
|
||||
# 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" > \
|
||||
"${LOCAL_FILES_DIR}/nginx/conf/nginx.dev.conf"
|
||||
# fi
|
||||
@@ -121,11 +123,6 @@ envsubst '${NGINX_EXTERNAL_PORT},${BACKEND_EXTERNAL_PORT},${DOCS_EXTERNAL_PORT},
|
||||
|
||||
# Дополнение 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
|
||||
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
|
||||
|
||||
# Удаляем временный файл
|
||||
|
||||
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: .
|
||||
|
||||
args:
|
||||
PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple}
|
||||
APT_PROXY: ${APT_PROXY}
|
||||
SOURCE_DIR: ./src/back
|
||||
PROJECT_DIR: .
|
||||
|
||||
|
||||
Regular → Executable
+6
@@ -21,12 +21,17 @@ services:
|
||||
- "${DB_PORT}:${DB_PORT}"
|
||||
|
||||
backend:
|
||||
image: portal-backend:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/dockerfiles/back_dev
|
||||
args:
|
||||
SOURCE_DIR: ./src/back
|
||||
PROJECT_DIR: .
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
@@ -52,6 +57,7 @@ services:
|
||||
|
||||
build:
|
||||
args:
|
||||
NPM_REGISTRY: ${NPM_REGISTRY}
|
||||
SOURCE_DIR: ./src/front
|
||||
context: .
|
||||
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
|
||||
|
||||
@@ -11,27 +11,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
pkg-config && \
|
||||
apt-get clean && \
|
||||
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
|
||||
|
||||
RUN chmod 777 /script/backend-entrypoint.sh && \
|
||||
python -m pip install --no-cache-dir poetry \
|
||||
&& poetry config virtualenvs.in-project true \
|
||||
&& poetry install --no-interaction --no-ansi
|
||||
pip install --index-url https://${PIP_INDEX_URL}/root/pypi/+simple/ --trusted-host ${PIP_INDEX_URL} --no-cache-dir --upgrade pip && \
|
||||
pip install --index-url https://${PIP_INDEX_URL}/root/pypi/+simple/ --trusted-host ${PIP_INDEX_URL} --no-cache-dir poetry && \
|
||||
# Убираем возможный старый 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
|
||||
#CMD ["tail", "-f", "/dev/null"]
|
||||
Regular → Executable
+9
-5
@@ -1,4 +1,4 @@
|
||||
FROM node:lts-alpine as bstage
|
||||
FROM node:lts-alpine AS bstage
|
||||
|
||||
ARG SOURCE_DIRFRONT
|
||||
ENV SOURCE_DIR=${SOURCE_DIRFRONT}
|
||||
@@ -12,7 +12,7 @@ COPY ${SOURCE_DIRFRONT}/*.cjs ./
|
||||
COPY ${SOURCE_DIRFRONT}/.* ./
|
||||
|
||||
COPY ${SOURCE_DIR}/*.js ./
|
||||
RUN npm cache clean --force && npm install
|
||||
RUN npm ci
|
||||
|
||||
COPY ${SOURCE_DIRFRONT} ./
|
||||
|
||||
@@ -27,7 +27,12 @@ WORKDIR /back
|
||||
ARG 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 \
|
||||
build-essential \
|
||||
pkg-config && \
|
||||
@@ -40,8 +45,7 @@ COPY ${SOURCE_DIR}/pyproject.toml ${SOURCE_DIR}/README.md ./
|
||||
COPY docker/entries/backend-entrypoint.sh /script/backend-entrypoint.sh
|
||||
|
||||
RUN chmod 777 /script/backend-entrypoint.sh && \
|
||||
python -m pip install --no-cache-dir poetry \
|
||||
&& poetry config virtualenvs.in-project true \
|
||||
python -m pip install --no-cache-dir poetry \
|
||||
&& poetry install --no-interaction --no-ansi
|
||||
##--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
|
||||
FROM node:lts-alpine as buildstage
|
||||
FROM node:lts-alpine AS buildstage
|
||||
|
||||
|
||||
ARG SOURCE_DIR
|
||||
ENV SOURCE_DIR=${SOURCE_DIR}
|
||||
# Устанавливаем рабочую директорию
|
||||
|
||||
ARG NPM_REGISTRY=https://registry.npmjs.org/
|
||||
ENV NPM_REGISTRY=${NPM_REGISTRY}
|
||||
WORKDIR /app
|
||||
|
||||
COPY ${SOURCE_DIR}/* ./
|
||||
|
||||
RUN npm cache clean --force && npm install
|
||||
|
||||
# Копируем остальные файлы приложения
|
||||
# COPY ${SOURCE_DIR} ./
|
||||
|
||||
RUN npm ci
|
||||
|
||||
EXPOSE 3000
|
||||
# COPY . .
|
||||
|
||||
Regular → Executable
+11
-13
@@ -5,23 +5,21 @@ do
|
||||
echo "Жду запуска сервера..."
|
||||
done
|
||||
|
||||
# until poetry run python manage.py makemigrations
|
||||
# do
|
||||
# echo "Создаю миграции..."
|
||||
# done
|
||||
until poetry run python manage.py makemigrations
|
||||
do
|
||||
echo "Создаю миграции..."
|
||||
done
|
||||
|
||||
|
||||
# until poetry run python manage.py migrate
|
||||
# do
|
||||
# echo "Применяю при необходимости..."
|
||||
# sleep 2
|
||||
# done
|
||||
until poetry run python manage.py migrate
|
||||
do
|
||||
echo "Применяю при необходимости..."
|
||||
sleep 2
|
||||
done
|
||||
poetry run python manage.py collectstatic --noinput
|
||||
if [ "$PRODUCTION" == "False" ]; then
|
||||
if [ "$AUTO_BACKEND" == "True" ]; then
|
||||
if [ "$PRODUCTION" == "False" ]; then
|
||||
poetry run python manage.py runserver 0.0.0.0:$BACKEND_INTERNAL_PORT
|
||||
else
|
||||
exec tail -f /dev/null
|
||||
|
||||
# &
|
||||
|
||||
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]
|
||||
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()'
|
||||
|
||||
|
||||
|
||||
# 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]
|
||||
# Настройки форматирования
|
||||
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]
|
||||
# Отключение определенных сообщений
|
||||
disable=C0114 # Missing module docstring
|
||||
disable=C0114,W0223
|
||||
|
||||
# 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
+24
-16
@@ -1,36 +1,44 @@
|
||||
from django.contrib import admin
|
||||
from .models import *
|
||||
from userauth.models import DictDepartment
|
||||
from django.db.models import Q
|
||||
|
||||
from userauth.models import DictDepartment
|
||||
|
||||
from .models import *
|
||||
|
||||
|
||||
class InspectionDirectionsAdmin(admin.ModelAdmin):
|
||||
list_display=('direction_title',)
|
||||
fields=('direction_title','icon_name',)
|
||||
list_display = ("direction_title",)
|
||||
fields = (
|
||||
"direction_title",
|
||||
"icon_name",
|
||||
)
|
||||
|
||||
def get_form(self, request, obj=None, **kwargs):
|
||||
form = super().get_form(request, obj, **kwargs)
|
||||
form.base_fields['direction_title'].label += " инспекции"
|
||||
form.base_fields["direction_title"].label += " инспекции"
|
||||
return form
|
||||
|
||||
def get_queryset(self, request):
|
||||
def get_queryset(self, request):
|
||||
qs = super().get_queryset(request)
|
||||
qs = qs.filter(department__isnull=True)
|
||||
|
||||
|
||||
|
||||
|
||||
return qs
|
||||
|
||||
|
||||
class VacanciesAdmin(admin.ModelAdmin):
|
||||
def get_form(self, request, obj=None, **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
|
||||
|
||||
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(FactSize)
|
||||
admin.site.register(InspectionDirections, InspectionDirectionsAdmin)
|
||||
|
||||
Regular → Executable
+3
-3
@@ -2,6 +2,6 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class AboutInspectionConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'about_inspection'
|
||||
verbose_name = 'Об инспекции'
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "about_inspection"
|
||||
verbose_name = "Об инспекции"
|
||||
Regular → Executable
+81
-42
@@ -1,86 +1,125 @@
|
||||
# Generated by Django 4.2.3 on 2025-01-31 09:42
|
||||
|
||||
import ckeditor_uploader.fields
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('userauth', '0001_initial'),
|
||||
("userauth", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='FactSize',
|
||||
name="FactSize",
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('factsize', models.IntegerField(verbose_name='Фактическая численность')),
|
||||
('date_created', models.DateField(verbose_name='Дата создания')),
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("factsize", models.IntegerField(verbose_name="Фактическая численность")),
|
||||
("date_created", models.DateField(verbose_name="Дата создания")),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Фактическая численность',
|
||||
'verbose_name_plural': 'Фактическая численность',
|
||||
"verbose_name": "Фактическая численность",
|
||||
"verbose_name_plural": "Фактическая численность",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='StateSize',
|
||||
name="StateSize",
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('statesize', models.IntegerField(verbose_name='Штатная численность')),
|
||||
('date_created', models.DateField(verbose_name='Дата создания')),
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("statesize", models.IntegerField(verbose_name="Штатная численность")),
|
||||
("date_created", models.DateField(verbose_name="Дата создания")),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Штатная численность',
|
||||
'verbose_name_plural': 'Штатная численность',
|
||||
"verbose_name": "Штатная численность",
|
||||
"verbose_name_plural": "Штатная численность",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Vacancies',
|
||||
name="Vacancies",
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('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='Базовые требования к соискателю')),
|
||||
('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='Отдел')),
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("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="Базовые требования к соискателю"
|
||||
),
|
||||
),
|
||||
("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={
|
||||
'verbose_name': 'Вакансия ',
|
||||
'verbose_name_plural': 'Вакансии',
|
||||
"verbose_name": "Вакансия ",
|
||||
"verbose_name_plural": "Вакансии",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ResponseVacancy',
|
||||
name="ResponseVacancy",
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('fio', models.CharField(max_length=300, verbose_name='ФИО')),
|
||||
('cdate', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
|
||||
('text', models.TextField(null=True, verbose_name='Сообщение')),
|
||||
('email', 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='Файл резюме')),
|
||||
('vacancy', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='get_vacancies', to='about_inspection.vacancies', verbose_name='Вакансия')),
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("fio", models.CharField(max_length=300, verbose_name="ФИО")),
|
||||
("cdate", models.DateTimeField(auto_now_add=True, verbose_name="Дата создания")),
|
||||
("text", models.TextField(null=True, verbose_name="Сообщение")),
|
||||
("email", 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="Файл резюме")),
|
||||
(
|
||||
"vacancy",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name="get_vacancies",
|
||||
to="about_inspection.vacancies",
|
||||
verbose_name="Вакансия",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Отклик на вакансию',
|
||||
'verbose_name_plural': 'Отклики на вакансию',
|
||||
"verbose_name": "Отклик на вакансию",
|
||||
"verbose_name_plural": "Отклики на вакансию",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='InspectionDirections',
|
||||
name="InspectionDirections",
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('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='Отдел')),
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("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="Отдел",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Направление деятельности ',
|
||||
'verbose_name_plural': 'Направления деятельности',
|
||||
"verbose_name": "Направление деятельности ",
|
||||
"verbose_name_plural": "Направления деятельности",
|
||||
},
|
||||
),
|
||||
]
|
||||
Regular → Executable
File mode changed.
Regular → Executable
+45
-26
@@ -1,65 +1,84 @@
|
||||
from django.db import models
|
||||
from userauth.models import DictDepartment
|
||||
from ckeditor_uploader.fields import RichTextUploadingField
|
||||
from django.db import models
|
||||
|
||||
from userauth.models import DictDepartment
|
||||
|
||||
|
||||
# Модель Штатная численность
|
||||
class StateSize(models.Model):
|
||||
statesize = models.IntegerField( verbose_name="Штатная численность")
|
||||
statesize = models.IntegerField(verbose_name="Штатная численность")
|
||||
date_created = models.DateField(verbose_name="Дата создания")
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Штатная численность"
|
||||
verbose_name_plural = "Штатная численность"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.statesize)
|
||||
|
||||
#Модель Фактическая численность
|
||||
return str(self.statesize)
|
||||
|
||||
|
||||
# Модель Фактическая численность
|
||||
class FactSize(models.Model):
|
||||
factsize = models.IntegerField( verbose_name="Фактическая численность")
|
||||
factsize = models.IntegerField(verbose_name="Фактическая численность")
|
||||
date_created = models.DateField(verbose_name="Дата создания")
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Фактическая численность"
|
||||
verbose_name_plural = "Фактическая численность"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.factsize)
|
||||
return str(self.factsize)
|
||||
|
||||
|
||||
# Модель Направление деятельности инспекции
|
||||
class InspectionDirections(models.Model):
|
||||
direction_title = models.CharField(max_length=255, verbose_name="Направление деятельности")
|
||||
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')
|
||||
|
||||
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",
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Направление деятельности "
|
||||
verbose_name_plural = "Направления деятельности"
|
||||
|
||||
def __str__(self):
|
||||
return self.direction_title
|
||||
|
||||
|
||||
|
||||
class Vacancies(models.Model):
|
||||
name=models.TextField(verbose_name="Наименование")
|
||||
department = models.ForeignKey (DictDepartment,on_delete=models.PROTECT, null=True, blank=True, verbose_name='Отдел')
|
||||
functional = RichTextUploadingField(null=True, blank= True, verbose_name='Функционал и должностные обязанности')
|
||||
requirements = RichTextUploadingField(null=True, blank= True, verbose_name='Базовые требования к соискателю')
|
||||
published = models.BooleanField(default = False, verbose_name="Опубликована")
|
||||
name = models.TextField(verbose_name="Наименование")
|
||||
department = models.ForeignKey(DictDepartment, on_delete=models.PROTECT, null=True, blank=True, verbose_name="Отдел")
|
||||
functional = RichTextUploadingField(null=True, blank=True, verbose_name="Функционал и должностные обязанности")
|
||||
requirements = RichTextUploadingField(null=True, blank=True, verbose_name="Базовые требования к соискателю")
|
||||
published = models.BooleanField(default=False, verbose_name="Опубликована")
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Вакансия "
|
||||
verbose_name_plural = "Вакансии"
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
|
||||
# Отклик на вакансию
|
||||
class ResponseVacancy(models.Model):
|
||||
fio = models.CharField(max_length=300, verbose_name='ФИО')
|
||||
cdate = models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')
|
||||
text = models.TextField(null=True, verbose_name='Сообщение')
|
||||
email = 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='Файл резюме')
|
||||
vacancy = models.ForeignKey(Vacancies, on_delete=models.PROTECT, related_name='get_vacancies', verbose_name='Вакансия')
|
||||
fio = models.CharField(max_length=300, verbose_name="ФИО")
|
||||
cdate = models.DateTimeField(auto_now_add=True, verbose_name="Дата создания")
|
||||
text = models.TextField(null=True, verbose_name="Сообщение")
|
||||
email = 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="Файл резюме")
|
||||
vacancy = models.ForeignKey(Vacancies, on_delete=models.PROTECT, related_name="get_vacancies", verbose_name="Вакансия")
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Отклик на вакансию"
|
||||
verbose_name_plural = "Отклики на вакансию"
|
||||
|
||||
def __str__(self):
|
||||
return self.fio
|
||||
return self.fio
|
||||
Regular → Executable
+51
-40
@@ -1,28 +1,38 @@
|
||||
from rest_framework import serializers
|
||||
from .models import *
|
||||
|
||||
from userauth.models import *
|
||||
from userauth.serializers import *
|
||||
|
||||
from .models import *
|
||||
|
||||
|
||||
# Сериализатор модели StateSize (Штатная численность)
|
||||
class StateSizeSerializer(serializers.ModelSerializer):
|
||||
size= serializers.IntegerField(source='statesize')
|
||||
class Meta:
|
||||
model = StateSize
|
||||
fields ='__all__'
|
||||
size = serializers.IntegerField(source="statesize")
|
||||
|
||||
class Meta:
|
||||
model = StateSize
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
# Сериализатор модели FactSize (Фактическая численность)
|
||||
class FactSizeSerializer(serializers.ModelSerializer):
|
||||
size= serializers.IntegerField(source='factsize')
|
||||
class Meta:
|
||||
model = FactSize
|
||||
fields ='__all__'
|
||||
size = serializers.IntegerField(source="factsize")
|
||||
|
||||
class Meta:
|
||||
model = FactSize
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
# Сериализатор модели InspectionDirections (Направление деятельности инспекции)
|
||||
class InspectionDirectionsSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = InspectionDirections
|
||||
fields =['id', 'direction_title', 'icon_name',]
|
||||
class Meta:
|
||||
model = InspectionDirections
|
||||
fields = [
|
||||
"id",
|
||||
"direction_title",
|
||||
"icon_name",
|
||||
]
|
||||
|
||||
|
||||
# Сериализаторы структуры инспекции
|
||||
@@ -34,47 +44,48 @@ class InspectionDirectionsSerializer(serializers.ModelSerializer):
|
||||
|
||||
# Основной сериализатор структуры инспекции
|
||||
class StructureSerializer(InfoUserCardSerializer):
|
||||
deps = serializers.SerializerMethodField('get_deps',)
|
||||
deps = serializers.SerializerMethodField(
|
||||
"get_deps",
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = DictEmployee
|
||||
fields = '__all__'
|
||||
|
||||
fields = "__all__"
|
||||
|
||||
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):
|
||||
chief_deps =serializers.SerializerMethodField('get_chief_deps')
|
||||
class Meta:
|
||||
model = DictDepartment
|
||||
fields = '__all__'
|
||||
|
||||
def get_chief_deps(self, obj):
|
||||
return InfoUserCardSerializer(obj.id_chief).data
|
||||
chief_deps = serializers.SerializerMethodField("get_chief_deps")
|
||||
|
||||
class Meta:
|
||||
model = DictDepartment
|
||||
fields = "__all__"
|
||||
|
||||
def get_chief_deps(self, obj):
|
||||
return InfoUserCardSerializer(obj.id_chief).data
|
||||
|
||||
|
||||
class DepartmentDirectionsSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = InspectionDirections
|
||||
fields = ["id","direction_title"]
|
||||
ordering = ['direction_title']
|
||||
|
||||
|
||||
class Meta:
|
||||
model = InspectionDirections
|
||||
fields = ["id", "direction_title"]
|
||||
ordering = ["direction_title"]
|
||||
|
||||
|
||||
class DepartmentSerializerVac(serializers.ModelSerializer):
|
||||
department_directions= DepartmentDirectionsSerializer(many=True, read_only=True)
|
||||
class Meta:
|
||||
model = DictDepartment
|
||||
fields = ['id','name','department_directions']
|
||||
department_directions = DepartmentDirectionsSerializer(many=True, read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = DictDepartment
|
||||
fields = ["id", "name", "department_directions"]
|
||||
|
||||
|
||||
class VacanciesSerializer(serializers.ModelSerializer):
|
||||
department = DepartmentSerializerVac(read_only=True)
|
||||
class Meta:
|
||||
model = Vacancies
|
||||
|
||||
fields = ["id", "department", "name","functional","requirements"]
|
||||
|
||||
department = DepartmentSerializerVac(read_only=True)
|
||||
|
||||
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.
|
||||
Regular → Executable
+8
-11
@@ -1,15 +1,12 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import *
|
||||
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('getfactsize/', GetFactSize.as_view(), name='getfactsize'),
|
||||
path('getstatesize/', GetStateSize.as_view(), name='getstatesize'),
|
||||
path('getinspectiondirections/', GetInspectionDirections.as_view(), name='getinspectiondirections'),
|
||||
path('getstructure/', GetStructure.as_view(), name='getstructure'),
|
||||
path('getvacancy/', GetVacancies.as_view(), name='getvacancy'),
|
||||
path('postresponsevacancy/', PostResponseVacancies.as_view(), name='postresponsevacancy'),
|
||||
|
||||
|
||||
]
|
||||
path("getfactsize/", GetFactSize.as_view(), name="getfactsize"),
|
||||
path("getstatesize/", GetStateSize.as_view(), name="getstatesize"),
|
||||
path("getinspectiondirections/", GetInspectionDirections.as_view(), name="getinspectiondirections"),
|
||||
path("getstructure/", GetStructure.as_view(), name="getstructure"),
|
||||
path("getvacancy/", GetVacancies.as_view(), name="getvacancy"),
|
||||
path("postresponsevacancy/", PostResponseVacancies.as_view(), name="postresponsevacancy"),
|
||||
]
|
||||
Regular → Executable
+39
-37
@@ -1,25 +1,22 @@
|
||||
import json
|
||||
|
||||
import requests
|
||||
from rest_framework.generics import ListAPIView
|
||||
from django.db.models import Q
|
||||
from userauth.models import DictEmployee, DictPosition
|
||||
from datetime import date
|
||||
from rest_framework.response import Response
|
||||
|
||||
from userauth.models import DictEmployee
|
||||
|
||||
from .models import *
|
||||
from .serializers import *
|
||||
from rest_framework.response import Response
|
||||
import json
|
||||
import requests
|
||||
|
||||
|
||||
class GetStateSize(ListAPIView):
|
||||
def get(self, request):
|
||||
state_size ={}
|
||||
state_size = {}
|
||||
try:
|
||||
|
||||
|
||||
state_size = StateSizeSerializer(StateSize.objects.latest('date_created')).data
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
|
||||
state_size = StateSizeSerializer(StateSize.objects.latest("date_created")).data
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return Response(state_size)
|
||||
|
||||
@@ -27,50 +24,55 @@ class GetStateSize(ListAPIView):
|
||||
class GetFactSize(ListAPIView):
|
||||
def get(self, request):
|
||||
|
||||
|
||||
|
||||
fact_size = {}
|
||||
try:
|
||||
fact_size = FactSizeSerializer(FactSize.objects.latest('date_created')).data
|
||||
except Exception as e:
|
||||
pass
|
||||
fact_size = FactSizeSerializer(FactSize.objects.latest("date_created")).data
|
||||
except Exception:
|
||||
pass
|
||||
return Response(fact_size)
|
||||
|
||||
|
||||
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):
|
||||
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)
|
||||
|
||||
|
||||
|
||||
class GetVacancies(ListAPIView):
|
||||
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)
|
||||
|
||||
|
||||
class PostResponseVacancies(ListAPIView):
|
||||
def post(self, request):
|
||||
|
||||
a = ResponseVacancy.objects.create(**json.loads(request.data['data']), file = request.data['file'] if 'file' in request.data else None)
|
||||
print(request.data, 'aaaaaaaaaaaaaa')
|
||||
|
||||
a = ResponseVacancy.objects.create(
|
||||
**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)
|
||||
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:
|
||||
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:
|
||||
print(e)
|
||||
|
||||
|
||||
return Response('Ваше резюме отправленно')
|
||||
|
||||
|
||||
|
||||
return Response("Ваше резюме отправленно")
|
||||
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
+7
-5
@@ -1,15 +1,17 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import *
|
||||
|
||||
# Register your models here.
|
||||
|
||||
|
||||
class UserAdmin(admin.ModelAdmin):
|
||||
save_on_top = True
|
||||
list_display=('username','names', 'is_active', 'is_staff')
|
||||
search_fields = ('username',)
|
||||
ordering=('username',)
|
||||
list_display = ("username", "names", "is_active", "is_staff")
|
||||
search_fields = ("username",)
|
||||
ordering = ("username",)
|
||||
|
||||
# fields=(('user', 'username'), 'is_active', 'is_staff', 'updated_at',)
|
||||
|
||||
|
||||
|
||||
admin.site.register(User, UserAdmin)
|
||||
admin.site.register(User, UserAdmin)
|
||||
Regular → Executable
+4
-4
@@ -2,7 +2,7 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class AccountsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'accounts'
|
||||
|
||||
verbose_name='Аккаунты Портала'
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "accounts"
|
||||
|
||||
verbose_name = "Аккаунты Портала"
|
||||
Regular → Executable
+47
-51
@@ -1,16 +1,15 @@
|
||||
import jwt
|
||||
import requests
|
||||
import json
|
||||
from django.conf import settings
|
||||
from portal.settings import myDEBUG
|
||||
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
|
||||
|
||||
import requests
|
||||
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()
|
||||
|
||||
|
||||
@@ -18,6 +17,7 @@ User = get_user_model()
|
||||
# def __init__(self, *args):
|
||||
# self.message = args[0] if args else "None"
|
||||
|
||||
|
||||
class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
|
||||
@classmethod
|
||||
def get_token(cls, user):
|
||||
@@ -25,73 +25,69 @@ class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
|
||||
token = super().get_token(user.userinfo)
|
||||
|
||||
# TODO В зависимости от базы Алексея, добавить поля или нет - надо подумать
|
||||
|
||||
|
||||
token['user']=model_to_dict(user.userinfo)
|
||||
token['user']['is_active']=user.is_active
|
||||
token['user']['is_staff']=user.is_staff
|
||||
token['user']['is_superuser']=user.is_superuser
|
||||
token['user']['is_idEmployee']=user.user_id
|
||||
|
||||
token["user"] = model_to_dict(user.userinfo)
|
||||
token["user"]["is_active"] = user.is_active
|
||||
token["user"]["is_staff"] = user.is_staff
|
||||
token["user"]["is_superuser"] = user.is_superuser
|
||||
token["user"]["is_idEmployee"] = user.user_id
|
||||
# !ТУТ СДЕЛАТь ФОТО НАВЕРНОЕ
|
||||
# token['user']['last_login']= user.last_login
|
||||
# print(token)
|
||||
return token
|
||||
except Exception as e:
|
||||
print("ERRRORRRRRRRR")
|
||||
print (e)
|
||||
|
||||
|
||||
|
||||
print(e)
|
||||
|
||||
|
||||
from django.contrib.auth.backends import ModelBackend
|
||||
|
||||
# from django.contrib.auth.models import User
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
class CustomAuth(ModelBackend):
|
||||
|
||||
def authenticate(self, request, **kwargs):
|
||||
username = kwargs['username']
|
||||
password = kwargs['password']
|
||||
status_code=0
|
||||
|
||||
username = kwargs["username"]
|
||||
password = kwargs["password"]
|
||||
status_code = 0
|
||||
|
||||
# !ТУт стучим в AD, потом к Алексею
|
||||
if myDEBUG!="True":
|
||||
if myDEBUG != "True":
|
||||
resp = requests.post(
|
||||
"http://10.252.44.13:8005/getAD", json.dumps({"user": username, "password": password, "usercheck": username})
|
||||
)
|
||||
|
||||
resp= requests.post('http://10.252.44.13:8005/getAD', json.dumps({'user': username, 'password':password, 'usercheck': username}))
|
||||
|
||||
# if True:
|
||||
status_code=resp.status_code
|
||||
status_code = resp.status_code
|
||||
else:
|
||||
|
||||
status_code=200
|
||||
status_code = 200
|
||||
# status_code=403
|
||||
|
||||
|
||||
if status_code==200:
|
||||
if status_code == 200:
|
||||
# try:
|
||||
|
||||
user = DictEmployee.objects.get(login=username)
|
||||
|
||||
if user.deleted!=1:
|
||||
|
||||
if user.deleted != 1:
|
||||
homeuser, created = User.objects.get_or_create(username=username)
|
||||
if created:
|
||||
homeuser.set_unusable_password()
|
||||
|
||||
homeuser.last_login= timezone.now()
|
||||
homeuser.user=user
|
||||
user.is_active=homeuser.is_active
|
||||
user.is_staff=homeuser.is_staff
|
||||
user.is_idEmployee=homeuser.user_id
|
||||
user.last_login=homeuser.last_login.strftime('%Y-%d-%m %H:%M:%S')
|
||||
homeuser.last_login = timezone.now()
|
||||
homeuser.user = user
|
||||
user.is_active = homeuser.is_active
|
||||
user.is_staff = homeuser.is_staff
|
||||
user.is_idEmployee = homeuser.user_id
|
||||
user.last_login = homeuser.last_login.strftime("%Y-%d-%m %H:%M:%S")
|
||||
homeuser.save()
|
||||
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:
|
||||
homeuser.birthdate = None
|
||||
user.birthdate=homeuser.birthdate
|
||||
homeuser.last_login=user.last_login
|
||||
user.id=homeuser.id
|
||||
homeuser.userinfo = user
|
||||
|
||||
user.birthdate = homeuser.birthdate
|
||||
homeuser.last_login = user.last_login
|
||||
user.id = homeuser.id
|
||||
homeuser.userinfo = user
|
||||
|
||||
return homeuser
|
||||
|
||||
|
||||
Regular → Executable
+54
-19
@@ -1,38 +1,73 @@
|
||||
# Generated by Django 4.2.3 on 2025-01-31 09:40
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('auth', '0012_alter_user_first_name_max_length'),
|
||||
('userauth', '0001_initial'),
|
||||
("auth", "0012_alter_user_first_name_max_length"),
|
||||
("userauth", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='User',
|
||||
name="User",
|
||||
fields=[
|
||||
('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')),
|
||||
('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='Пароль')),
|
||||
('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')),
|
||||
("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")),
|
||||
(
|
||||
"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="Пароль")),
|
||||
("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={
|
||||
'verbose_name': 'Зарегистрированный участник',
|
||||
'verbose_name_plural': 'Зарегистрированные участники',
|
||||
"verbose_name": "Зарегистрированный участник",
|
||||
"verbose_name_plural": "Зарегистрированные участники",
|
||||
},
|
||||
),
|
||||
]
|
||||
Regular → Executable
File mode changed.
Regular → Executable
+25
-44
@@ -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 datetime import datetime, timedelta
|
||||
import requests
|
||||
from django.contrib.auth import authenticate
|
||||
import json
|
||||
from django.forms.models import model_to_dict
|
||||
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
|
||||
from django.contrib.auth.models import PermissionsMixin, UserManager
|
||||
from django.db import models
|
||||
|
||||
# from django.utils.translation import ugettext_lazy as _
|
||||
from userauth.models import DictEmployee
|
||||
|
||||
# all_fk: dict = {
|
||||
@@ -24,8 +12,8 @@ from userauth.models import DictEmployee
|
||||
# "organization":Organization,
|
||||
# "position": Position,
|
||||
# "rank": Rank
|
||||
# }
|
||||
|
||||
# }
|
||||
|
||||
# class Position(models.Model):
|
||||
# name= models.CharField(verbose_name='Название', max_length=150, blank=True)
|
||||
# class Meta:
|
||||
@@ -34,57 +22,50 @@ from userauth.models import DictEmployee
|
||||
# def __str__(self):
|
||||
# return str(self.name)
|
||||
|
||||
|
||||
class UserManager(BaseUserManager):
|
||||
|
||||
def create_superuser(self, username, password):
|
||||
""" Создает и возввращет пользователя с привилегиями суперадмина. """
|
||||
def create_superuser(self, username, password):
|
||||
"""Создает и возввращет пользователя с привилегиями суперадмина."""
|
||||
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_staff = True
|
||||
user.set_password(password)
|
||||
user.save()
|
||||
|
||||
return user
|
||||
|
||||
|
||||
|
||||
class User(AbstractBaseUser, PermissionsMixin):
|
||||
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='Пароль')
|
||||
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)
|
||||
is_active = models.BooleanField(default=True, verbose_name='Активность')
|
||||
is_staff = models.BooleanField(default=False, verbose_name='Доступ в Админку')
|
||||
class User(AbstractBaseUser, PermissionsMixin):
|
||||
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="Пароль")
|
||||
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)
|
||||
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)
|
||||
# last_login = models.DateTimeField(auto_now=True, null=True)
|
||||
# external=models.ForeignKey(DictEmployee,db_constraint=False, null=True, on_delete=models.PROTECT)
|
||||
objects = UserManager()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Meta:
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Зарегистрированный участник"
|
||||
verbose_name_plural = "Зарегистрированные участники"
|
||||
|
||||
USERNAME_FIELD = 'username'
|
||||
|
||||
USERNAME_FIELD = "username"
|
||||
|
||||
# REQUIRED_FIELDS = ['username']
|
||||
def __str__(self):
|
||||
return str(self.username)
|
||||
|
||||
|
||||
def fio(self):
|
||||
|
||||
return self.user.login
|
||||
|
||||
|
||||
def names(self):
|
||||
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):
|
||||
charset = 'utf-8'
|
||||
charset = "utf-8"
|
||||
|
||||
def render(self, data, media_type=None, renderer_context=None):
|
||||
# Если мы получим ключ token как часть ответа, это будет байтовый
|
||||
# объект. Байтовые объекты плохо сериализуются, поэтому нам нужно
|
||||
# декодировать их перед рендерингом объекта User.
|
||||
token = data.get('token', None)
|
||||
token = data.get("token", None)
|
||||
|
||||
if token is not None and isinstance(token, bytes):
|
||||
# Как говорится выше, декодирует token если он имеет тип bytes.
|
||||
data['token'] = token.decode('utf-8')
|
||||
data["token"] = token.decode("utf-8")
|
||||
# Наконец, мы можем отобразить наши данные в простанстве имен 'user'.
|
||||
return json.dumps({
|
||||
'user': data,
|
||||
|
||||
})
|
||||
return json.dumps(
|
||||
{
|
||||
"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.
|
||||
Regular → Executable
+11
-15
@@ -1,19 +1,15 @@
|
||||
from django.urls import include, path
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from django.urls import path
|
||||
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView
|
||||
|
||||
from .views import *
|
||||
|
||||
from rest_framework_simplejwt.views import (
|
||||
TokenObtainPairView,
|
||||
TokenRefreshView,TokenVerifyView
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
path('token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
||||
path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
||||
path('token/verify/', TokenVerifyView.as_view(), name='token_access'),
|
||||
path('getuser/', getuserAPIView.as_view(), name='getuserAPIView', ),
|
||||
|
||||
|
||||
]
|
||||
path("token/", TokenObtainPairView.as_view(), name="token_obtain_pair"),
|
||||
path("token/refresh/", TokenRefreshView.as_view(), name="token_refresh"),
|
||||
path("token/verify/", TokenVerifyView.as_view(), name="token_access"),
|
||||
path(
|
||||
"getuser/",
|
||||
getuserAPIView.as_view(),
|
||||
name="getuserAPIView",
|
||||
),
|
||||
]
|
||||
Regular → Executable
+10
-13
@@ -1,17 +1,19 @@
|
||||
from rest_framework.permissions import AllowAny, IsAuthenticated
|
||||
from rest_framework.permissions import AllowAny
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from userauth.models import *
|
||||
|
||||
from navigation.models import *
|
||||
from navigation.serializers import *
|
||||
from userauth.models import *
|
||||
from userauth.serializers import *
|
||||
|
||||
from .models import *
|
||||
from .serializers import *
|
||||
|
||||
|
||||
class getuserAPIView(APIView):
|
||||
permission_classes = (AllowAny,)
|
||||
|
||||
|
||||
def get(self, request):
|
||||
"""
|
||||
Параметр: userlogin
|
||||
@@ -19,19 +21,14 @@ class getuserAPIView(APIView):
|
||||
Результат: Выдает все данные о пользователе
|
||||
Если дать дополнительный параметр fullinfo = True, то будет выдаваться информация с комиссиями и ответсвенностью
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
resp = None
|
||||
fullinfo = request.query_params.get('fullinfo')
|
||||
queryset = DictEmployee.objects.get(login=request.query_params.get('userlogin'))
|
||||
if(fullinfo is None or fullinfo == False ):
|
||||
fullinfo = request.query_params.get("fullinfo")
|
||||
queryset = DictEmployee.objects.get(login=request.query_params.get("userlogin"))
|
||||
if fullinfo is None or fullinfo == False:
|
||||
resp = InfoUserCardSerializer(queryset).data
|
||||
|
||||
else:
|
||||
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 .models import *
|
||||
|
||||
# Register your models here.
|
||||
|
||||
|
||||
class ExclusionDatesAdmin(admin.ModelAdmin):
|
||||
list_display=('exclusiondate',)
|
||||
list_display = ("exclusiondate",)
|
||||
|
||||
|
||||
admin.site.register(ExclusionDates, ExclusionDatesAdmin)
|
||||
admin.site.register(Calendar)
|
||||
|
||||
Regular → Executable
+3
-3
@@ -2,6 +2,6 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class CalendarOfEventsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'calendar_of_events'
|
||||
verbose_name = 'Календарь событий'
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "calendar_of_events"
|
||||
verbose_name = "Календарь событий"
|
||||
Regular → Executable
+103
-47
@@ -1,97 +1,153 @@
|
||||
# Generated by Django 4.2.3 on 2025-01-31 09:42
|
||||
|
||||
import ckeditor_uploader.fields
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('userauth', '0001_initial'),
|
||||
("userauth", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Calendar',
|
||||
name="Calendar",
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('cl_name', models.CharField(max_length=300, verbose_name='Название')),
|
||||
('cl_color', models.CharField(max_length=300, null=True, 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='Автор календаря')),
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("cl_name", models.CharField(max_length=300, verbose_name="Название")),
|
||||
("cl_color", models.CharField(max_length=300, null=True, 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="Автор календаря"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Календарь',
|
||||
'verbose_name_plural': 'Календари',
|
||||
"verbose_name": "Календарь",
|
||||
"verbose_name_plural": "Календари",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Event',
|
||||
name="Event",
|
||||
fields=[
|
||||
('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='Название')),
|
||||
('date_start', 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='Периодичность события')),
|
||||
('description', 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='Календарь')),
|
||||
("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="Название")),
|
||||
("date_start", 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="Периодичность события")),
|
||||
(
|
||||
"description",
|
||||
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={
|
||||
'verbose_name': 'Событие календаря',
|
||||
'verbose_name_plural': 'События календаря',
|
||||
"verbose_name": "Событие календаря",
|
||||
"verbose_name_plural": "События календаря",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ExclusionDates',
|
||||
name="ExclusionDates",
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('exclusiondate', models.DateField(blank=True, null=True, verbose_name='Дата-исключение')),
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("exclusiondate", models.DateField(blank=True, null=True, verbose_name="Дата-исключение")),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Дата-исключение',
|
||||
'verbose_name_plural': 'Даты-исключение',
|
||||
"verbose_name": "Дата-исключение",
|
||||
"verbose_name_plural": "Даты-исключение",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='EventParticipant',
|
||||
name="EventParticipant",
|
||||
fields=[
|
||||
('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='Участник')),
|
||||
("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="Участник",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Участники события',
|
||||
'verbose_name_plural': 'Участники событий',
|
||||
"verbose_name": "Участники события",
|
||||
"verbose_name_plural": "Участники событий",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='EventFiles',
|
||||
name="EventFiles",
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('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='Событие')),
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("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="Событие",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Файлы календаря',
|
||||
'verbose_name_plural': 'Файлы календаря',
|
||||
"verbose_name": "Файлы календаря",
|
||||
"verbose_name_plural": "Файлы календаря",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CalendarParticipants',
|
||||
name="CalendarParticipants",
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('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='Участник')),
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("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="Участник"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Участники календаря',
|
||||
'verbose_name_plural': 'Участники календаря',
|
||||
'unique_together': {('participant_calendar', 'calendar')},
|
||||
"verbose_name": "Участники календаря",
|
||||
"verbose_name_plural": "Участники календаря",
|
||||
"unique_together": {("participant_calendar", "calendar")},
|
||||
},
|
||||
),
|
||||
]
|
||||
Regular → Executable
-1
@@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("calendar_of_events", "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
+47
-40
@@ -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 ckeditor_uploader.fields import RichTextUploadingField
|
||||
|
||||
# Create your models here.
|
||||
from django.db import models
|
||||
|
||||
from accounts.models import *
|
||||
|
||||
# class CalendarEventsName(models.Model):
|
||||
# """ Глобавльное название календаря"""
|
||||
@@ -12,11 +12,9 @@ from ckeditor_uploader.fields import RichTextUploadingField
|
||||
# author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор Календаря')
|
||||
|
||||
|
||||
|
||||
|
||||
# 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='Описание события')
|
||||
# content = RichTextUploadingField(null=True, blank= True, verbose_name='Полное описание события')
|
||||
# startdate = models.DateTimeField(null=True, blank= True, verbose_name='Дата начала события')
|
||||
@@ -24,23 +22,23 @@ from ckeditor_uploader.fields import RichTextUploadingField
|
||||
# enddate = models.DateTimeField(null=True, blank= True, verbose_name='Дата снятия с публикации')
|
||||
# frequency = models.JSONField(verbose_name='Периодичность', null=True, blank= True)
|
||||
# author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор события')
|
||||
# place = models.CharField(null=True, blank= True, max_length=500, verbose_name='Место проведения события')
|
||||
# place = models.CharField(null=True, blank= True, max_length=500, verbose_name='Место проведения события')
|
||||
# calendarname = models.ForeignKey(CalendarEventsNam, on_delete=models.PROTECT, related_name='get_calendar_events_name', verbose_name='Название для календаря')
|
||||
|
||||
|
||||
# class Meta:
|
||||
# verbose_name = "Календарь событий"
|
||||
# verbose_name_plural = "Календарь событий"
|
||||
# verbose_name_plural = "Календарь событий"
|
||||
|
||||
# def __str__(self):
|
||||
# return str(self.name)
|
||||
|
||||
# class FilesEvent(models.Model):
|
||||
# """ Прикрепленные файлы к событию"""
|
||||
# # name = models.CharField(max_length=300, null=True, blank=True, verbose_name='Название файла')
|
||||
# # name = models.CharField(max_length=300, null=True, blank=True, verbose_name='Название файла')
|
||||
# link = models.FileField(upload_to='calendar/%Y/%m/%d')
|
||||
# event = models.ForeignKey(CalendarEvents, on_delete=models.PROTECT, null=True, blank= True, related_name='get_calendar_events_files', verbose_name='Событие к которому привязаны файлы')
|
||||
|
||||
|
||||
# class ParticipantsEvent(models.Model):
|
||||
# """ Участники события """
|
||||
# participant = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Участник события')
|
||||
@@ -49,65 +47,73 @@ from ckeditor_uploader.fields import RichTextUploadingField
|
||||
|
||||
# Модели(Таблицы) для хранения календаря
|
||||
class Calendar(models.Model):
|
||||
author = models.ForeignKey(DictEmployee, on_delete=models.PROTECT, null=True, verbose_name='Автор календаря')
|
||||
cl_name = models.CharField(max_length=300, verbose_name='Название')
|
||||
cl_color = models.CharField(max_length=300, verbose_name='Цвет', null=True)
|
||||
cl_descr = models.CharField(max_length=300, verbose_name='Описание')
|
||||
|
||||
author = models.ForeignKey(DictEmployee, on_delete=models.PROTECT, null=True, verbose_name="Автор календаря")
|
||||
cl_name = models.CharField(max_length=300, verbose_name="Название")
|
||||
cl_color = models.CharField(max_length=300, verbose_name="Цвет", null=True)
|
||||
cl_descr = models.CharField(max_length=300, verbose_name="Описание")
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Календарь"
|
||||
verbose_name_plural = "Календари"
|
||||
verbose_name_plural = "Календари"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.cl_name)
|
||||
|
||||
|
||||
class CalendarParticipants(models.Model):
|
||||
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='Календарь')
|
||||
editor = models.BooleanField(default=False, 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="Календарь")
|
||||
editor = models.BooleanField(default=False, verbose_name="Редактирование")
|
||||
|
||||
class Meta:
|
||||
unique_together = ["participant_calendar", "calendar"]
|
||||
verbose_name = "Участники календаря"
|
||||
verbose_name_plural = "Участники календаря"
|
||||
verbose_name_plural = "Участники календаря"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.participant_calendar)
|
||||
|
||||
|
||||
class Event(models.Model):
|
||||
name = models.CharField(max_length=300, verbose_name='Название', null=True, blank=True)
|
||||
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='Событие на целый день')
|
||||
|
||||
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:
|
||||
verbose_name = "Событие календаря"
|
||||
verbose_name_plural = "События календаря"
|
||||
verbose_name_plural = "События календаря"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.name)
|
||||
|
||||
|
||||
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.CASCADE, related_name='get_calendar_event_files',blank=True,null=True, verbose_name='Событие')
|
||||
file = models.FileField(upload_to='calendar/%Y/%m/%d')
|
||||
event = models.ForeignKey(
|
||||
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:
|
||||
verbose_name = "Файлы календаря"
|
||||
verbose_name_plural = "Файлы календаря"
|
||||
verbose_name_plural = "Файлы календаря"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.file)
|
||||
|
||||
|
||||
class EventParticipant(models.Model):
|
||||
participant = models.ForeignKey(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='Календарь')
|
||||
participant = models.ForeignKey(
|
||||
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:
|
||||
verbose_name = "Участники события"
|
||||
@@ -118,13 +124,14 @@ class EventParticipant(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:
|
||||
verbose_name = "Дата-исключение"
|
||||
verbose_name_plural = "Даты-исключение"
|
||||
verbose_name_plural = "Даты-исключение"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.exclusiondate)
|
||||
Regular → Executable
+69
-68
@@ -1,135 +1,141 @@
|
||||
from rest_framework import serializers
|
||||
from .models import *
|
||||
|
||||
from about_inspection.models import *
|
||||
from userauth.serializers import *
|
||||
from userauth.serializers import *
|
||||
|
||||
from .models import *
|
||||
|
||||
|
||||
class IdonlyRequieredSerializer(serializers.Serializer):
|
||||
id = serializers.IntegerField(required=False)
|
||||
|
||||
|
||||
class CalendarParticipantsSerializer(serializers.ModelSerializer):
|
||||
""" Сериализатор участников календаря """
|
||||
|
||||
"""Сериализатор участников календаря"""
|
||||
|
||||
class Meta:
|
||||
model = CalendarParticipants
|
||||
exclude = ['calendar']
|
||||
|
||||
|
||||
exclude = ["calendar"]
|
||||
|
||||
|
||||
class EventParticipantSerializer(serializers.ModelSerializer):
|
||||
""" Сериализатор участников календаря """
|
||||
|
||||
"""Сериализатор участников календаря"""
|
||||
|
||||
class Meta:
|
||||
model = CalendarParticipants
|
||||
exclude = ['event']
|
||||
exclude = ["event"]
|
||||
|
||||
|
||||
class EventParticipantSerializerIDonly(serializers.RelatedField):
|
||||
def to_representation(self, value):
|
||||
def to_representation(self, value):
|
||||
return value.participant.id
|
||||
|
||||
# pass
|
||||
|
||||
|
||||
class CalendarEventSerializer(serializers.ModelSerializer):
|
||||
""" Сериализатор событий календаря """
|
||||
"""Сериализатор событий календаря"""
|
||||
|
||||
# participant = EventParticipantSerializerIDonly(many=True, read_only=True, source='get_event_participant')
|
||||
class Meta:
|
||||
model = Event
|
||||
fields = '__all__'
|
||||
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
class CalendarsSerializer(serializers.ModelSerializer):
|
||||
""" Сериализатор календарей """
|
||||
|
||||
"""Сериализатор календарей"""
|
||||
|
||||
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):
|
||||
# r = self.context.get("request")
|
||||
# r = self.context.get("request")
|
||||
# return obj.get_user.filter(participant_calendar=r.user.user.id).last().editor
|
||||
|
||||
class Meta:
|
||||
model = Calendar
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
class CalendarParticipantsSerializerFullInfo(serializers.ModelSerializer):
|
||||
def to_representation(self, value):
|
||||
def to_representation(self, value):
|
||||
return UserSerializerBase(value.participant_calendar).data
|
||||
|
||||
class Meta:
|
||||
model = CalendarParticipants
|
||||
exclude = ['calendar']
|
||||
|
||||
exclude = ["calendar"]
|
||||
|
||||
|
||||
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:
|
||||
model = Calendar
|
||||
fields = '__all__'
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
class EventFilesSerializer(serializers.ModelSerializer):
|
||||
""" Сериализатор файлов календаря """
|
||||
"""Сериализатор файлов календаря"""
|
||||
|
||||
class Meta:
|
||||
model = EventFiles
|
||||
fields = '__all__'
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
class EventSerializerIdRequest(serializers.ModelSerializer):
|
||||
participant = EventParticipantSerializerIDonly(source="get_event_participant", many= True, read_only=True)
|
||||
files = EventFilesSerializer(many=True, source='get_calendar_event_files')
|
||||
participant = EventParticipantSerializerIDonly(source="get_event_participant", many=True, read_only=True)
|
||||
files = EventFilesSerializer(many=True, source="get_calendar_event_files")
|
||||
|
||||
class Meta:
|
||||
model = Event
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
class TableEventParticipantSerializer(serializers.ModelSerializer):
|
||||
""" Сериализатор участников календаря """
|
||||
"""Сериализатор участников календаря"""
|
||||
|
||||
class Meta:
|
||||
model = EventParticipant
|
||||
fields = '__all__'
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
# Запрос сотрудников
|
||||
|
||||
|
||||
class EmployeeSerializer(serializers.ModelSerializer):
|
||||
title = serializers.CharField(source='name')
|
||||
selected=serializers.BooleanField(default=False)
|
||||
editor=serializers.BooleanField(default=False)
|
||||
employees = serializers.SerializerMethodField('get_deps')
|
||||
title = serializers.CharField(source="name")
|
||||
selected = serializers.BooleanField(default=False)
|
||||
editor = serializers.BooleanField(default=False)
|
||||
employees = serializers.SerializerMethodField("get_deps")
|
||||
|
||||
class Meta:
|
||||
model = DictDepartment
|
||||
fields = ["title","id","employees",'selected', 'editor']
|
||||
|
||||
def get_deps(self,obj):
|
||||
|
||||
fields = ["title", "id", "employees", "selected", "editor"]
|
||||
|
||||
def get_deps(self, obj):
|
||||
|
||||
return UsersSerializer(obj.dep_user.filter(deleted=0), many=True).data
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
|
||||
class UserSerializerBase(serializers.ModelSerializer):
|
||||
title = serializers.CharField(source='fio')
|
||||
title = serializers.CharField(source="fio")
|
||||
|
||||
class Meta:
|
||||
model = DictEmployee
|
||||
fields = ['title', "id" ]
|
||||
fields = ["title", "id"]
|
||||
|
||||
|
||||
class UsersSerializer(UserSerializerBase):
|
||||
editor=serializers.BooleanField(default=False)
|
||||
selected=serializers.BooleanField(default=False)
|
||||
editor = serializers.BooleanField(default=False)
|
||||
selected = serializers.BooleanField(default=False)
|
||||
|
||||
class Meta:
|
||||
model = DictEmployee
|
||||
fields = ['title', "id", 'id_dict_department','selected','editor' ]
|
||||
fields = ["title", "id", "id_dict_department", "selected", "editor"]
|
||||
|
||||
|
||||
class DeleteCalendarSerializer(serializers.Serializer):
|
||||
@@ -137,30 +143,25 @@ class DeleteCalendarSerializer(serializers.Serializer):
|
||||
|
||||
|
||||
class MyCalendarPostParametersParticipants(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
class Meta:
|
||||
model = CalendarParticipants
|
||||
exclude = ['calendar','id']
|
||||
|
||||
|
||||
|
||||
exclude = ["calendar", "id"]
|
||||
|
||||
|
||||
class MyCalendarPostParameters(serializers.ModelSerializer):
|
||||
id=serializers.IntegerField(required=False)
|
||||
id = serializers.IntegerField(required=False)
|
||||
# author = serializers.IntegerField(required=False)
|
||||
participant = MyCalendarPostParametersParticipants(source="get_participants", many=True, required=False)
|
||||
|
||||
|
||||
class Meta:
|
||||
model = Calendar
|
||||
exclude =['author']
|
||||
exclude = ["author"]
|
||||
|
||||
|
||||
|
||||
class CreateUpdateEventSerializer(serializers.Serializer):
|
||||
event = serializers.JSONField()
|
||||
# participant= serializers.ListSerializer(child=serializers.IntegerField(), required=False)
|
||||
|
||||
# class Meta:
|
||||
# model = Event
|
||||
# fields = '__all__'
|
||||
# fields = '__all__'
|
||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
Regular → Executable
+4
-5
@@ -1,13 +1,12 @@
|
||||
from django.urls import path
|
||||
from rest_framework.routers import DefaultRouter
|
||||
|
||||
from .views import *
|
||||
|
||||
urlpatterns = [
|
||||
# path('calendarEvents/', CalendarEventsAPIView.as_view(), name='calendarEvents'),
|
||||
path('get_employees/', GetEmployees.as_view(), name='get_employees'),
|
||||
path('my_calendars/', MyCalendars.as_view(), name='get_calendars'),
|
||||
path('exclusion_dates/', ExclusionDatesAPIView.as_view(), name='exclusion_dates'),
|
||||
path('my_events/', MyEvents.as_view(), name='myvents')
|
||||
path("get_employees/", GetEmployees.as_view(), name="get_employees"),
|
||||
path("my_calendars/", MyCalendars.as_view(), name="get_calendars"),
|
||||
path("exclusion_dates/", ExclusionDatesAPIView.as_view(), name="exclusion_dates"),
|
||||
path("my_events/", MyEvents.as_view(), name="myvents"),
|
||||
# path('createEvents/', CreateEventsAPIView.as_view(), name='createEvents')
|
||||
]
|
||||
Regular → Executable
+133
-130
@@ -1,187 +1,191 @@
|
||||
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
|
||||
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
|
||||
|
||||
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):
|
||||
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)
|
||||
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)
|
||||
return Response({year:months})
|
||||
return Response({year: months})
|
||||
|
||||
|
||||
class MyCalendars(APIView):
|
||||
|
||||
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()
|
||||
return Response(CalendarsSerializer(calendars,many=True).data)
|
||||
|
||||
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()
|
||||
return Response(CalendarsSerializer(calendars, many=True).data)
|
||||
|
||||
@swagger_auto_schema(request_body=MyCalendarPostParameters)
|
||||
def post(self,request):
|
||||
'''
|
||||
def post(self, request):
|
||||
"""
|
||||
Создание/редактирование календаря
|
||||
если нет id = пойдет создавать календарь. В противном случае - на обновление
|
||||
|
||||
|
||||
'''
|
||||
"""
|
||||
|
||||
try:
|
||||
ob = MyCalendarPostParameters(data=request.data)
|
||||
|
||||
try:
|
||||
|
||||
ob=MyCalendarPostParameters(data=request.data)
|
||||
|
||||
if ob.is_valid():
|
||||
ob = ob.data
|
||||
participant = ob['participant'] if 'participant' in ob else False
|
||||
|
||||
del ob['participant']
|
||||
if 'id' in ob:
|
||||
newcal,created = Calendar.objects.update_or_create(id=ob['id'],defaults=ob)
|
||||
|
||||
else:
|
||||
newcal=Calendar.objects.create(**ob, author=DictEmployee(id=request.user.user.id))
|
||||
|
||||
ob = ob.data
|
||||
participant = ob["participant"] if "participant" in ob else False
|
||||
|
||||
del ob["participant"]
|
||||
if "id" in ob:
|
||||
newcal, created = Calendar.objects.update_or_create(id=ob["id"], defaults=ob)
|
||||
|
||||
else:
|
||||
newcal = Calendar.objects.create(**ob, author=DictEmployee(id=request.user.user.id))
|
||||
|
||||
if participant != False:
|
||||
ptspnt = []
|
||||
|
||||
|
||||
for x in participant:
|
||||
x['participant_calendar']=DictEmployee(id=x['participant_calendar'])
|
||||
|
||||
newpart, created = CalendarParticipants.objects.update_or_create(calendar=newcal, participant_calendar=x['participant_calendar'],
|
||||
defaults=x)
|
||||
|
||||
ptspnt.append(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"], defaults=x
|
||||
)
|
||||
|
||||
ptspnt.append(x["participant_calendar"])
|
||||
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:
|
||||
return Response({"mess":"Ошибка валидации полей"})
|
||||
return Response({"mess": "Ошибка валидации полей"})
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return Response({"mess":"Ошибка операции"})
|
||||
return Response({"mess": "Ошибка операции"})
|
||||
|
||||
return Response({"mess": f"Календарь успешно {'обновлен' if 'id' in ob else 'создан'}"})
|
||||
|
||||
|
||||
|
||||
@swagger_auto_schema(query_serializer=DeleteCalendarSerializer)
|
||||
def delete(self,request):
|
||||
def delete(self, request):
|
||||
try:
|
||||
Calendar.objects.get(id=request.query_params.get("delid")).delete()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return Response({'mess':'Удаление не удалось'})
|
||||
return Response({"mess": "Удаление не удалось"})
|
||||
return Response({"mess": "Календарь удален"})
|
||||
|
||||
|
||||
|
||||
class GetEmployees(APIView):
|
||||
def get(self, request):
|
||||
|
||||
queryset = DictDepartment.objects.filter(deleted=0,id__gt=0)
|
||||
|
||||
return Response(EmployeeSerializer(queryset, many=True).data)
|
||||
|
||||
queryset = DictDepartment.objects.filter(deleted=0, id__gt=0)
|
||||
|
||||
return Response(EmployeeSerializer(queryset, many=True).data)
|
||||
|
||||
|
||||
class MyEvents(APIView):
|
||||
parser_classes = [MultiPartParser]
|
||||
|
||||
@swagger_auto_schema(query_serializer=IdonlyRequieredSerializer)
|
||||
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()
|
||||
resp = {'mycalendars':CalendarsSerializerForEventEdit(allcalendars, many=True).data }
|
||||
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()
|
||||
resp = {"mycalendars": CalendarsSerializerForEventEdit(allcalendars, many=True).data}
|
||||
if request.query_params.get("id") is not None:
|
||||
event = Event.objects.get(id = request.query_params.get("id"))
|
||||
resp['event']=EventSerializerIdRequest(event).data
|
||||
event = Event.objects.get(id=request.query_params.get("id"))
|
||||
resp["event"] = EventSerializerIdRequest(event).data
|
||||
# events = Event.objects.filter(calendar__id = request.query_params.get("id"))
|
||||
# resp['events'] = EventSerializerIdRequest(events, many=True).data
|
||||
return Response(resp)
|
||||
|
||||
|
||||
|
||||
|
||||
@swagger_auto_schema(
|
||||
request_body=CreateUpdateEventSerializer,
|
||||
manual_parameters=[
|
||||
|
||||
openapi.Parameter('event', openapi.IN_FORM, 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='Документы'),])
|
||||
|
||||
request_body=CreateUpdateEventSerializer,
|
||||
manual_parameters=[
|
||||
openapi.Parameter(
|
||||
"event",
|
||||
openapi.IN_FORM,
|
||||
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])
|
||||
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':[объекты файлов, которые не будут удалены]
|
||||
"""
|
||||
К сожалению, у этого сваггера есть ограничения на несколько файлов, поэтому тут схемы для них не будет
|
||||
Но мы будем отправлять ровно также
|
||||
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( {
|
||||
# "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
|
||||
|
||||
'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:
|
||||
event = json.loads(request.data['event'])
|
||||
event = json.loads(request.data["event"])
|
||||
# event = json.loads(event)
|
||||
|
||||
filesadd = request.FILES.getlist('files')
|
||||
|
||||
|
||||
filesadd = request.FILES.getlist("files")
|
||||
|
||||
# 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']
|
||||
|
||||
|
||||
evnt=None
|
||||
if 'id' in event:
|
||||
evnt,created=Event.objects.update_or_create(id=event['id'], defaults = event)
|
||||
files = [x["id"] for x in event["files"]]
|
||||
|
||||
del event["files"]
|
||||
del event["participant"]
|
||||
|
||||
evnt = None
|
||||
if "id" in event:
|
||||
evnt, created = Event.objects.update_or_create(id=event["id"], defaults=event)
|
||||
|
||||
else:
|
||||
evnt=Event.objects.create(**event)
|
||||
evnt = Event.objects.create(**event)
|
||||
|
||||
|
||||
for x in participant:
|
||||
EventParticipant.objects.update_or_create(event=evnt,participant=DictEmployee(id=x))
|
||||
|
||||
EventParticipant.objects.filter(event=evnt).exclude(participant__id__in=participant).delete()
|
||||
EventParticipant.objects.update_or_create(event=evnt, participant=DictEmployee(id=x))
|
||||
|
||||
EventParticipant.objects.filter(event=evnt).exclude(participant__id__in=participant).delete()
|
||||
|
||||
delfiles = EventFiles.objects.filter(event=evnt).exclude(id__in=files)
|
||||
|
||||
@@ -193,18 +197,17 @@ class MyEvents(APIView):
|
||||
delfiles.delete()
|
||||
|
||||
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:
|
||||
return Response({'mess':f'Произошла ошибка'})
|
||||
|
||||
return Response({"mess": "Произошла ошибка"})
|
||||
|
||||
@swagger_auto_schema(query_serializer=DeleteCalendarSerializer)
|
||||
def delete(self,request):
|
||||
def delete(self, request):
|
||||
try:
|
||||
Event.objects.get(id=request.query_params.get("delid")).delete()
|
||||
except Exception as 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 .models import *
|
||||
|
||||
from userauth.models import DictEmployee
|
||||
|
||||
from .models import *
|
||||
|
||||
# Register your models here.
|
||||
|
||||
|
||||
@@ -9,21 +12,32 @@ from userauth.models import DictEmployee
|
||||
|
||||
# class DictEmployeeAdmin(admin.ModelAdmin):
|
||||
class IlineComitteeFiles(admin.StackedInline):
|
||||
|
||||
fields = ('file_name','is_actual',)
|
||||
fields = (
|
||||
"file_name",
|
||||
"is_actual",
|
||||
)
|
||||
model = Committee1Files
|
||||
extra = 0
|
||||
|
||||
|
||||
class InlineComiteePeople(admin.StackedInline):
|
||||
model = Committee2
|
||||
extra = 0
|
||||
|
||||
|
||||
class Committee1Admin(admin.ModelAdmin):
|
||||
readonly_fields = ['id']
|
||||
list_display = ( 'num_start', 'name',)
|
||||
search_fields = ('num_start', 'name',)
|
||||
readonly_fields = ["id"]
|
||||
list_display = (
|
||||
"num_start",
|
||||
"name",
|
||||
)
|
||||
search_fields = (
|
||||
"num_start",
|
||||
"name",
|
||||
)
|
||||
inlines = [IlineComitteeFiles, InlineComiteePeople]
|
||||
|
||||
|
||||
class InlineRespFiles(admin.StackedInline):
|
||||
model = OrderResponsibilityFiles
|
||||
extra = 0
|
||||
@@ -31,20 +45,22 @@ class InlineRespFiles(admin.StackedInline):
|
||||
|
||||
class InlineRespEmp(admin.StackedInline):
|
||||
model = OrderResponsibilityEmployee
|
||||
extra=0
|
||||
extra = 0
|
||||
|
||||
def formfield_for_foreignkey(self, db_field, request, **kwargs):
|
||||
if db_field.name == 'employee':
|
||||
kwargs['queryset'] = DictEmployee.objects.filter(deleted=0)
|
||||
if db_field.name == "employee":
|
||||
kwargs["queryset"] = DictEmployee.objects.filter(deleted=0)
|
||||
return super().formfield_for_foreignkey(db_field, request, **kwargs)
|
||||
|
||||
|
||||
class OrderResponsibilityAdmin(admin.ModelAdmin):
|
||||
# model= OrderResponsibility
|
||||
list_display = ( 'number', 'name')
|
||||
search_fields = ('number', 'name',)
|
||||
inlines=[InlineRespFiles,InlineRespEmp]
|
||||
|
||||
|
||||
|
||||
list_display = ("number", "name")
|
||||
search_fields = (
|
||||
"number",
|
||||
"name",
|
||||
)
|
||||
inlines = [InlineRespFiles, InlineRespEmp]
|
||||
|
||||
|
||||
admin.site.register(Committee1, Committee1Admin)
|
||||
|
||||
Regular → Executable
+3
-3
@@ -2,6 +2,6 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class CommeterespConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'commeteresp'
|
||||
verbose_name = 'Ответственность и комиссии'
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "commeteresp"
|
||||
verbose_name = "Ответственность и комиссии"
|
||||
Regular → Executable
+110
-86
@@ -4,154 +4,178 @@ from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Committee1',
|
||||
name="Committee1",
|
||||
fields=[
|
||||
('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)),
|
||||
('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)),
|
||||
("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),
|
||||
),
|
||||
("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={
|
||||
'verbose_name': 'Комиссия',
|
||||
'verbose_name_plural': 'Комиссии',
|
||||
'db_table': 'committee1',
|
||||
'db_table_comment': '╤яшёюъ ъюьшёёшщ',
|
||||
'managed': False,
|
||||
"verbose_name": "Комиссия",
|
||||
"verbose_name_plural": "Комиссии",
|
||||
"db_table": "committee1",
|
||||
"db_table_comment": "╤яшёюъ ъюьшёёшщ",
|
||||
"managed": False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Committee1Files',
|
||||
name="Committee1Files",
|
||||
fields=[
|
||||
('id', models.PositiveIntegerField(primary_key=True, serialize=False)),
|
||||
('file_name', models.FileField(blank=True, null=True, upload_to='comitee_files')),
|
||||
('is_actual', models.IntegerField(db_comment='╧Ёшчэръ ръЄєры№эюёЄш Їрщыр', verbose_name='Актуальность')),
|
||||
("id", models.PositiveIntegerField(primary_key=True, serialize=False)),
|
||||
("file_name", models.FileField(blank=True, null=True, upload_to="comitee_files")),
|
||||
("is_actual", models.IntegerField(db_comment="╧Ёшчэръ ръЄєры№эюёЄш Їрщыр", verbose_name="Актуальность")),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Файл',
|
||||
'verbose_name_plural': 'Файлы',
|
||||
'db_table': 'committee1_files',
|
||||
'managed': False,
|
||||
"verbose_name": "Файл",
|
||||
"verbose_name_plural": "Файлы",
|
||||
"db_table": "committee1_files",
|
||||
"managed": False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Committee2',
|
||||
name="Committee2",
|
||||
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={
|
||||
'verbose_name': 'Участник',
|
||||
'verbose_name_plural': 'Участники',
|
||||
'db_table': 'committee2',
|
||||
'db_table_comment': '╤юёЄрт ъюьшёёшщ',
|
||||
'managed': False,
|
||||
"verbose_name": "Участник",
|
||||
"verbose_name_plural": "Участники",
|
||||
"db_table": "committee2",
|
||||
"db_table_comment": "╤юёЄрт ъюьшёёшщ",
|
||||
"managed": False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DictCommitteeExpert',
|
||||
name="DictCommitteeExpert",
|
||||
fields=[
|
||||
('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)),
|
||||
('tel', models.CharField(blank=True, db_comment='╥хыхЇюэ', max_length=100, null=True)),
|
||||
("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)),
|
||||
("tel", models.CharField(blank=True, db_comment="╥хыхЇюэ", max_length=100, null=True)),
|
||||
],
|
||||
options={
|
||||
'db_table': 'dict_committee_expert',
|
||||
'db_table_comment': '╤яЁртюўэшъ эхчртшёшь√ї ¤ъёяхЁЄют',
|
||||
'managed': False,
|
||||
"db_table": "dict_committee_expert",
|
||||
"db_table_comment": "╤яЁртюўэшъ эхчртшёшь√ї ¤ъёяхЁЄют",
|
||||
"managed": False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DictCommitteeOrderAddon',
|
||||
name="DictCommitteeOrderAddon",
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('number', models.CharField(db_comment='═юьхЁ шчьхэхэшщ ъ яЁшърчє ю ъюьшёёшш', max_length=100)),
|
||||
('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)),
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("number", models.CharField(db_comment="═юьхЁ шчьхэхэшщ ъ яЁшърчє ю ъюьшёёшш", max_length=100)),
|
||||
("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)),
|
||||
],
|
||||
options={
|
||||
'db_table': 'dict_committee_order_addon',
|
||||
'db_table_comment': '╥рсышЎр фюяюыэхэшщ ъ яЁшърчє ю ъюьшёёшш',
|
||||
'managed': False,
|
||||
"db_table": "dict_committee_order_addon",
|
||||
"db_table_comment": "╥рсышЎр фюяюыэхэшщ ъ яЁшърчє ю ъюьшёёшш",
|
||||
"managed": False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DictCommitteePosition',
|
||||
name="DictCommitteePosition",
|
||||
fields=[
|
||||
('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_short', models.CharField(blank=True, db_comment='ъЁрЄъюх эршьхэютрэшх фюцэюёЄш т ъюьшёёшш', max_length=100, null=True)),
|
||||
('ord', models.IntegerField(blank=True, db_comment='╧юЁ\xa0фюъ ёюЁЄшЁютъш', null=True)),
|
||||
("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_short",
|
||||
models.CharField(
|
||||
blank=True, db_comment="ъЁрЄъюх эршьхэютрэшх фюцэюёЄш т ъюьшёёшш", max_length=100, null=True
|
||||
),
|
||||
),
|
||||
("ord", models.IntegerField(blank=True, db_comment="╧юЁ\xa0фюъ ёюЁЄшЁютъш", null=True)),
|
||||
],
|
||||
options={
|
||||
'db_table': 'dict_committee_position',
|
||||
'db_table_comment': '╤яЁртюўэшъ фюыцэюёЄхщ ъюьшёёшщ',
|
||||
'managed': False,
|
||||
"db_table": "dict_committee_position",
|
||||
"db_table_comment": "╤яЁртюўэшъ фюыцэюёЄхщ ъюьшёёшщ",
|
||||
"managed": False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DictCommitteeType',
|
||||
name="DictCommitteeType",
|
||||
fields=[
|
||||
('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)),
|
||||
("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)),
|
||||
],
|
||||
options={
|
||||
'db_table': 'dict_committee_type',
|
||||
'db_table_comment': '╤яЁртюўэшъ тшфют ъюьшёёшщ',
|
||||
'managed': False,
|
||||
"db_table": "dict_committee_type",
|
||||
"db_table_comment": "╤яЁртюўэшъ тшфют ъюьшёёшщ",
|
||||
"managed": False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='OrderResponsibility',
|
||||
name="OrderResponsibility",
|
||||
fields=[
|
||||
('id', models.PositiveIntegerField(db_comment='╥рсхы№э√щ эюьхЁ', primary_key=True, serialize=False)),
|
||||
('number', models.CharField(db_comment='═юьхЁ яЁшърчр', max_length=50)),
|
||||
('date', models.DateField(db_comment='─рЄр яЁшърчр')),
|
||||
('name', models.CharField(db_comment='═рчтрэшх яЁшърчр', max_length=1024)),
|
||||
('sphere_of_responsibility', models.CharField(db_comment='╤ЇхЁр юЄтхЄёЄтхээюёЄш ёюЄЁєфэшъют, эрчэрўрхьр\xa0 фрээ√ь яЁшърчюь', max_length=1024)),
|
||||
("id", models.PositiveIntegerField(db_comment="╥рсхы№э√щ эюьхЁ", primary_key=True, serialize=False)),
|
||||
("number", models.CharField(db_comment="═юьхЁ яЁшърчр", max_length=50)),
|
||||
("date", models.DateField(db_comment="─рЄр яЁшърчр")),
|
||||
("name", models.CharField(db_comment="═рчтрэшх яЁшърчр", max_length=1024)),
|
||||
(
|
||||
"sphere_of_responsibility",
|
||||
models.CharField(
|
||||
db_comment="╤ЇхЁр юЄтхЄёЄтхээюёЄш ёюЄЁєфэшъют, эрчэрўрхьр\xa0 фрээ√ь яЁшърчюь", max_length=1024
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Cфера ответственности',
|
||||
'verbose_name_plural': 'Сферы ответстсвенности',
|
||||
'db_table': 'order_responsibility',
|
||||
'db_table_comment': '╥рсышЎр яЁшърчют ю эрчэрўхэшш юЄтхЄёЄтхээ√ї ёюЄЁєфэшъют',
|
||||
'managed': False,
|
||||
"verbose_name": "Cфера ответственности",
|
||||
"verbose_name_plural": "Сферы ответстсвенности",
|
||||
"db_table": "order_responsibility",
|
||||
"db_table_comment": "╥рсышЎр яЁшърчют ю эрчэрўхэшш юЄтхЄёЄтхээ√ї ёюЄЁєфэшъют",
|
||||
"managed": False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='OrderResponsibilityEmployee',
|
||||
name="OrderResponsibilityEmployee",
|
||||
fields=[
|
||||
('id', models.PositiveIntegerField(db_comment='╥рсхы№э√щ эюьхЁ', primary_key=True, serialize=False)),
|
||||
("id", models.PositiveIntegerField(db_comment="╥рсхы№э√щ эюьхЁ", primary_key=True, serialize=False)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Ответственный сотрудник',
|
||||
'verbose_name_plural': 'Ответственные сотрудники',
|
||||
'db_table': 'order_responsibility_employee',
|
||||
'managed': False,
|
||||
"verbose_name": "Ответственный сотрудник",
|
||||
"verbose_name_plural": "Ответственные сотрудники",
|
||||
"db_table": "order_responsibility_employee",
|
||||
"managed": False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='OrderResponsibilityFiles',
|
||||
name="OrderResponsibilityFiles",
|
||||
fields=[
|
||||
('id', models.PositiveIntegerField(db_comment='╥рсхы№э√щ эюьхЁ', primary_key=True, serialize=False)),
|
||||
('file_name', models.FileField(blank=True, null=True, upload_to='resp_files')),
|
||||
('is_actual', models.IntegerField(db_comment='╧Ёшчэръ ръЄєры№эюёЄш Їрщыр')),
|
||||
("id", models.PositiveIntegerField(db_comment="╥рсхы№э√щ эюьхЁ", primary_key=True, serialize=False)),
|
||||
("file_name", models.FileField(blank=True, null=True, upload_to="resp_files")),
|
||||
("is_actual", models.IntegerField(db_comment="╧Ёшчэръ ръЄєры№эюёЄш Їрщыр")),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Файл сферы ответственности',
|
||||
'verbose_name_plural': 'Файлы сферы ответственности',
|
||||
'db_table': 'order_responsibility_files',
|
||||
'managed': False,
|
||||
"verbose_name": "Файл сферы ответственности",
|
||||
"verbose_name_plural": "Файлы сферы ответственности",
|
||||
"db_table": "order_responsibility_files",
|
||||
"managed": False,
|
||||
},
|
||||
),
|
||||
]
|
||||
Regular → Executable
File mode changed.
Regular → Executable
+152
-79
@@ -1,160 +1,233 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
# Create your models here.
|
||||
class Committee1(models.Model):
|
||||
id= models.PositiveIntegerField(primary_key=True)
|
||||
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='═юьхЁ яЁшърчр ю ёючфрэшш ъюьшёёшш')
|
||||
date_start = models.DateField(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='─рЄр єяЁрчфэхэш ъюьшёёшш')
|
||||
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_master = models.ForeignKey('self', models.DO_NOTHING, db_column='id_master', blank=True, null=True, db_comment='╙═ т√°хёЄю ∙хщ ъюьшёёшш',verbose_name = 'Комиссия-родитель')
|
||||
id = models.PositiveIntegerField(primary_key=True)
|
||||
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="═юьхЁ яЁшърчр ю ёючфрэшш ъюьшёёшш")
|
||||
date_start = models.DateField(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="─рЄр єяЁрчфэхэш ъюьшёёшш")
|
||||
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_master = models.ForeignKey(
|
||||
"self",
|
||||
models.DO_NOTHING,
|
||||
db_column="id_master",
|
||||
blank=True,
|
||||
null=True,
|
||||
db_comment="╙═ т√°хёЄю ∙хщ ъюьшёёшш",
|
||||
verbose_name="Комиссия-родитель",
|
||||
)
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
db_table = 'committee1'
|
||||
db_table_comment = '╤яшёюъ ъюьшёёшщ'
|
||||
verbose_name = 'Комиссия'
|
||||
verbose_name_plural = 'Комиссии'
|
||||
db_table = "committee1"
|
||||
db_table_comment = "╤яшёюъ ъюьшёёшщ"
|
||||
verbose_name = "Комиссия"
|
||||
verbose_name_plural = "Комиссии"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.name)
|
||||
|
||||
|
||||
class Committee1Files(models.Model):
|
||||
id= models.PositiveIntegerField(primary_key=True)
|
||||
id_committee1 = models.ForeignKey(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')
|
||||
id = models.PositiveIntegerField(primary_key=True)
|
||||
id_committee1 = models.ForeignKey(
|
||||
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='╚ь Їрщыр')
|
||||
is_actual = models.IntegerField(db_comment='╧Ёшчэръ ръЄєры№эюёЄш Їрщыр',verbose_name = 'Актуальность')
|
||||
is_actual = models.IntegerField(db_comment="╧Ёшчэръ ръЄєры№эюёЄш Їрщыр", verbose_name="Актуальность")
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
db_table = 'committee1_files'
|
||||
verbose_name = 'Файл'
|
||||
verbose_name_plural = 'Файлы'
|
||||
db_table = "committee1_files"
|
||||
verbose_name = "Файл"
|
||||
verbose_name_plural = "Файлы"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.file_name)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
|
||||
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
class Committee2(models.Model):
|
||||
id_committee1 = models.ForeignKey(Committee1, models.DO_NOTHING, 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='╙эшъры№э√щ эюьхЁ ¤ъёяхЁЄр')
|
||||
id_committee1 = models.ForeignKey(
|
||||
Committee1,
|
||||
models.DO_NOTHING,
|
||||
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:
|
||||
managed = False
|
||||
db_table = 'committee2'
|
||||
db_table_comment = '╤юёЄрт ъюьшёёшщ'
|
||||
verbose_name = 'Участник'
|
||||
verbose_name_plural = 'Участники'
|
||||
db_table = "committee2"
|
||||
db_table_comment = "╤юёЄрт ъюьшёёшщ"
|
||||
verbose_name = "Участник"
|
||||
verbose_name_plural = "Участники"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.committee_position.name)
|
||||
|
||||
|
||||
class DictCommitteeExpert(models.Model):
|
||||
fio = models.CharField(max_length=250, blank=True, null=True, db_comment='╘╚╬ ¤ъёяхЁЄр')
|
||||
tel = models.CharField(max_length=100, 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="╥хыхЇюэ")
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
db_table = 'dict_committee_expert'
|
||||
db_table_comment = '╤яЁртюўэшъ эхчртшёшь√ї ¤ъёяхЁЄют'
|
||||
|
||||
db_table = "dict_committee_expert"
|
||||
db_table_comment = "╤яЁртюўэшъ эхчртшёшь√ї ¤ъёяхЁЄют"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.fio)
|
||||
|
||||
|
||||
class DictCommitteeOrderAddon(models.Model):
|
||||
id_committee1 = models.ForeignKey(Committee1, models.DO_NOTHING, db_column='id_committee1', 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='╥хъёЄ шчьхэхэшщ т яЁшърч ю ъюьшёёшш')
|
||||
id_committee1 = models.ForeignKey(
|
||||
Committee1,
|
||||
models.DO_NOTHING,
|
||||
db_column="id_committee1",
|
||||
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:
|
||||
managed = False
|
||||
db_table = 'dict_committee_order_addon'
|
||||
db_table_comment = '╥рсышЎр фюяюыэхэшщ ъ яЁшърчє ю ъюьшёёшш'
|
||||
|
||||
db_table = "dict_committee_order_addon"
|
||||
db_table_comment = "╥рсышЎр фюяюыэхэшщ ъ яЁшърчє ю ъюьшёёшш"
|
||||
|
||||
|
||||
class DictCommitteePosition(models.Model):
|
||||
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='ъЁрЄъюх эршьхэютрэшх фюцэюёЄш т ъюьшёёшш')
|
||||
ord = models.IntegerField(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="ъЁрЄъюх эршьхэютрэшх фюцэюёЄш т ъюьшёёшш")
|
||||
ord = models.IntegerField(blank=True, null=True, db_comment="╧юЁ фюъ ёюЁЄшЁютъш")
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
db_table = 'dict_committee_position'
|
||||
db_table_comment = '╤яЁртюўэшъ фюыцэюёЄхщ ъюьшёёшщ'
|
||||
db_table = "dict_committee_position"
|
||||
db_table_comment = "╤яЁртюўэшъ фюыцэюёЄхщ ъюьшёёшщ"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.name_short)
|
||||
|
||||
|
||||
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:
|
||||
managed = False
|
||||
db_table = 'dict_committee_type'
|
||||
db_table_comment = '╤яЁртюўэшъ тшфют ъюьшёёшщ'
|
||||
db_table = "dict_committee_type"
|
||||
db_table_comment = "╤яЁртюўэшъ тшфют ъюьшёёшщ"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.name)
|
||||
|
||||
|
||||
|
||||
class OrderResponsibility(models.Model):
|
||||
id = models.PositiveIntegerField(primary_key=True, db_comment='╥рсхы№э√щ эюьхЁ')
|
||||
number = models.CharField(max_length=50, db_comment='═юьхЁ яЁшърчр')
|
||||
date = models.DateField(db_comment='─рЄр яЁшърчр')
|
||||
name = models.CharField(max_length=1024, db_comment='═рчтрэшх яЁшърчр')
|
||||
sphere_of_responsibility = models.CharField(max_length=1024, db_comment='╤ЇхЁр юЄтхЄёЄтхээюёЄш ёюЄЁєфэшъют, эрчэрўрхьр фрээ√ь яЁшърчюь')
|
||||
id = models.PositiveIntegerField(primary_key=True, db_comment="╥рсхы№э√щ эюьхЁ")
|
||||
number = models.CharField(max_length=50, db_comment="═юьхЁ яЁшърчр")
|
||||
date = models.DateField(db_comment="─рЄр яЁшърчр")
|
||||
name = models.CharField(max_length=1024, db_comment="═рчтрэшх яЁшърчр")
|
||||
sphere_of_responsibility = models.CharField(
|
||||
max_length=1024, db_comment="╤ЇхЁр юЄтхЄёЄтхээюёЄш ёюЄЁєфэшъют, эрчэрўрхьр фрээ√ь яЁшърчюь"
|
||||
)
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
db_table = 'order_responsibility'
|
||||
db_table_comment = '╥рсышЎр яЁшърчют ю эрчэрўхэшш юЄтхЄёЄтхээ√ї ёюЄЁєфэшъют'
|
||||
verbose_name = 'Cфера ответственности'
|
||||
verbose_name_plural = 'Сферы ответстсвенности'
|
||||
db_table = "order_responsibility"
|
||||
db_table_comment = "╥рсышЎр яЁшърчют ю эрчэрўхэшш юЄтхЄёЄтхээ√ї ёюЄЁєфэшъют"
|
||||
verbose_name = "Cфера ответственности"
|
||||
verbose_name_plural = "Сферы ответстсвенности"
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.number} - {self.name}'
|
||||
return f"{self.number} - {self.name}"
|
||||
|
||||
|
||||
class OrderResponsibilityEmployee(models.Model):
|
||||
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.
|
||||
employee = models.ForeignKey('userauth.DictEmployee', models.DO_NOTHING, db_column='id_dict_employee', db_comment='╚─ ёюЄЁєфэшър, ъюЄюЁ√щ эрчэрўхэ юЄтхЄёЄтхээ√ь яю фрээюьє яЁшърчє', related_name="user_respons")
|
||||
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.
|
||||
employee = models.ForeignKey(
|
||||
"userauth.DictEmployee",
|
||||
models.DO_NOTHING,
|
||||
db_column="id_dict_employee",
|
||||
db_comment="╚─ ёюЄЁєфэшър, ъюЄюЁ√щ эрчэрўхэ юЄтхЄёЄтхээ√ь яю фрээюьє яЁшърчє",
|
||||
related_name="user_respons",
|
||||
)
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
db_table = 'order_responsibility_employee'
|
||||
unique_together = (('id_order_responsibility', 'employee'),)
|
||||
verbose_name = 'Ответственный сотрудник'
|
||||
verbose_name_plural = 'Ответственные сотрудники'
|
||||
db_table = "order_responsibility_employee"
|
||||
unique_together = (("id_order_responsibility", "employee"),)
|
||||
verbose_name = "Ответственный сотрудник"
|
||||
verbose_name_plural = "Ответственные сотрудники"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.employee)
|
||||
|
||||
|
||||
|
||||
class OrderResponsibilityFiles(models.Model):
|
||||
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")
|
||||
file_name = models.FileField(null=True, blank=True, upload_to='resp_files')
|
||||
is_actual = models.IntegerField(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",
|
||||
)
|
||||
file_name = models.FileField(null=True, blank=True, upload_to="resp_files")
|
||||
is_actual = models.IntegerField(db_comment="╧Ёшчэръ ръЄєры№эюёЄш Їрщыр")
|
||||
|
||||
class Meta:
|
||||
managed = False
|
||||
db_table = 'order_responsibility_files'
|
||||
verbose_name = 'Файл сферы ответственности'
|
||||
verbose_name_plural = 'Файлы сферы ответственности'
|
||||
|
||||
|
||||
db_table = "order_responsibility_files"
|
||||
verbose_name = "Файл сферы ответственности"
|
||||
verbose_name_plural = "Файлы сферы ответственности"
|
||||
|
||||
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 django.db.models import Count
|
||||
|
||||
from .models import *
|
||||
|
||||
|
||||
class DictCommitteePositionSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = DictCommitteePosition
|
||||
fields = '__all__'
|
||||
class Meta:
|
||||
model = DictCommitteePosition
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
DictCommitteeExpert
|
||||
|
||||
|
||||
class DictCommitteeExpertSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = DictCommitteeExpert
|
||||
fields = '__all__'
|
||||
class Meta:
|
||||
model = DictCommitteeExpert
|
||||
fields = "__all__"
|
||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Regular → Executable
File mode changed.
Regular → Executable
+20
-23
@@ -1,59 +1,56 @@
|
||||
from django.contrib import admin
|
||||
from .models import *
|
||||
from django.db.models import Avg
|
||||
|
||||
class BaseCriteriaAdmin(admin.ModelAdmin):
|
||||
list_display=('name', 'rating')
|
||||
from .models import *
|
||||
|
||||
|
||||
class BaseCriteriaAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "rating")
|
||||
|
||||
|
||||
class RatingStatusInline(admin.TabularInline):
|
||||
model = RatingStatus
|
||||
fields = ( 'crit', 'rating')
|
||||
readonly_fields=( 'crit', 'rating')
|
||||
fields = ("crit", "rating")
|
||||
readonly_fields = ("crit", "rating")
|
||||
can_delete = False
|
||||
show_change_link = False
|
||||
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):
|
||||
ratavg = obj.get_rating.aggregate(res=Avg('rating'))
|
||||
|
||||
return int(ratavg['res']) if float(ratavg['res']).is_integer() else round(ratavg['res'], 1)
|
||||
|
||||
ratavg = obj.get_rating.aggregate(res=Avg("rating"))
|
||||
|
||||
|
||||
get_rat.short_description="Средняя оценка"
|
||||
return int(ratavg["res"]) if float(ratavg["res"]).is_integer() else round(ratavg["res"], 1)
|
||||
|
||||
get_rat.short_description = "Средняя оценка"
|
||||
|
||||
inlines = [RatingStatusInline]
|
||||
|
||||
|
||||
|
||||
|
||||
# class RatingStatusAdmin(admin.ModelAdmin):
|
||||
# # inlines = [RatingStatusInline]
|
||||
# fields = ('get_name','get_login', ('crit', 'rating'), 'usercom', 'get_time')
|
||||
# list_display=('get_name','get_login', 'crit', 'rating', 'usercom', 'get_time')
|
||||
|
||||
|
||||
# readonly_fields=('get_name','get_login', 'crit', 'rating', 'usercom', 'get_time')
|
||||
# list_filter=('crit',)
|
||||
|
||||
# def get_time(self, obj):
|
||||
# return obj.usercom.time_create
|
||||
|
||||
|
||||
# def get_name(self, obj):
|
||||
# return obj.usercom.user.fio()
|
||||
|
||||
|
||||
# def get_login(self, obj):
|
||||
# return obj.usercom.user
|
||||
|
||||
|
||||
# get_time.short_description="Дата создания"
|
||||
# get_name.short_description="ФИО"
|
||||
# get_login.short_description="Логин"
|
||||
|
||||
Regular → Executable
+2
-2
@@ -2,6 +2,6 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class FeedbackConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'feedback'
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "feedback"
|
||||
verbose_name = "Обратная связь"
|
||||
Regular → Executable
+36
-29
@@ -1,51 +1,58 @@
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
|
||||
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 = "Справочник - Критерии оценки"
|
||||
verbose_name_plural = "Справочник - Критерии оценки"
|
||||
def __str__(self):
|
||||
return str(self.name)
|
||||
|
||||
# Первичная модель
|
||||
class UserComment(models.Model):
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, 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='Полезность')
|
||||
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 = "Комментарии пользователя"
|
||||
verbose_name = "Справочник - Критерии оценки"
|
||||
verbose_name_plural = "Справочник - Критерии оценки"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.name)
|
||||
|
||||
|
||||
# Первичная модель
|
||||
class UserComment(models.Model):
|
||||
user = models.ForeignKey(
|
||||
settings.AUTH_USER_MODEL,
|
||||
editable=False,
|
||||
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:
|
||||
verbose_name = "Комментарий пользователя"
|
||||
verbose_name_plural = "Комментарии пользователя"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.user.fio())
|
||||
|
||||
def names(self):
|
||||
return DictEmployee.objects.get(login=self.user)
|
||||
|
||||
names.short_description="ФИО"
|
||||
|
||||
names.short_description = "ФИО"
|
||||
|
||||
|
||||
# Дочерняя модель
|
||||
class RatingStatus(models.Model):
|
||||
crit = models.ForeignKey(BaseCriteria, on_delete=models.PROTECT, related_name='get_criteria', verbose_name='Критерий')
|
||||
rating = models.FloatField(verbose_name='Рейтинг')
|
||||
usercom = models.ForeignKey(UserComment, on_delete=models.PROTECT, related_name='get_rating', verbose_name='Комментарий')
|
||||
crit = models.ForeignKey(BaseCriteria, on_delete=models.PROTECT, related_name="get_criteria", verbose_name="Критерий")
|
||||
rating = models.FloatField(verbose_name="Рейтинг")
|
||||
usercom = models.ForeignKey(UserComment, on_delete=models.PROTECT, related_name="get_rating", verbose_name="Комментарий")
|
||||
|
||||
class Meta:
|
||||
|
||||
verbose_name = "Рейтинг"
|
||||
verbose_name_plural = "Рейтинги"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.crit)
|
||||
|
||||
|
||||
Regular → Executable
+40
-32
@@ -1,44 +1,52 @@
|
||||
from rest_framework import serializers
|
||||
from .models import *
|
||||
|
||||
from userauth.serializers import *
|
||||
|
||||
from .models import *
|
||||
|
||||
|
||||
class BaseCriteriaAllSerializer(serializers.ModelSerializer):
|
||||
""" Забирает все поля из модели по хранению названия критерия оценки,
|
||||
используемой иконки, рейтинга по умолчанию, и цвет для иконки
|
||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||
"""
|
||||
class Meta:
|
||||
model = BaseCriteria
|
||||
fields = '__all__'
|
||||
"""Забирает все поля из модели по хранению названия критерия оценки,
|
||||
используемой иконки, рейтинга по умолчанию, и цвет для иконки
|
||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = BaseCriteria
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
class RatingStatusSerializer(serializers.ModelSerializer):
|
||||
""" Забирает все поля из модели по хранению критерия оценки,
|
||||
какую поставили по критерию, и к какому коментарию оно относится
|
||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||
"""
|
||||
class Meta:
|
||||
model = RatingStatus
|
||||
fields ='__all__'
|
||||
|
||||
"""Забирает все поля из модели по хранению критерия оценки,
|
||||
какую поставили по критерию, и к какому коментарию оно относится
|
||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = RatingStatus
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
class FeedbackUserCommentSerializer(serializers.ModelSerializer):
|
||||
""" Забирает все поля из модели, без расшифровки пользователя
|
||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||
"""
|
||||
class Meta:
|
||||
model = UserComment
|
||||
fields = '__all__'
|
||||
"""Забирает все поля из модели, без расшифровки пользователя
|
||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = UserComment
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
|
||||
class UserCommentSerializer(serializers.ModelSerializer):
|
||||
"""Используется в представлении DataForStatisticsAPIView, для сбора информации
|
||||
feed - берет все поля из модели с UserComment, и добавляет информацию об авторе
|
||||
"""
|
||||
author = serializers.SerializerMethodField('get_user')
|
||||
class Meta:
|
||||
model = UserComment
|
||||
fields = '__all__'
|
||||
"""Используется в представлении DataForStatisticsAPIView, для сбора информации
|
||||
feed - берет все поля из модели с UserComment, и добавляет информацию об авторе
|
||||
"""
|
||||
|
||||
def get_user(self, obj):
|
||||
return InfoUserCardSerializer(obj.user.user).data
|
||||
author = serializers.SerializerMethodField("get_user")
|
||||
|
||||
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.
|
||||
Regular → Executable
+3
-5
@@ -1,9 +1,7 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import *
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('feedbackdata/', FeedbackAPIView.as_view(), name='feedbackdata'),
|
||||
|
||||
|
||||
]
|
||||
path("feedbackdata/", FeedbackAPIView.as_view(), name="feedbackdata"),
|
||||
]
|
||||
Regular → Executable
+34
-45
@@ -1,70 +1,59 @@
|
||||
from rest_framework.response import Response
|
||||
import datetime
|
||||
from .serializers import *
|
||||
from .models import *
|
||||
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
|
||||
|
||||
class FeedbackAPIView(APIView):
|
||||
from .models import *
|
||||
from .serializers import *
|
||||
|
||||
|
||||
class FeedbackAPIView(APIView):
|
||||
def get(self, request):
|
||||
"""Оценка сайта. Собираем информацию о критериях оценки, поставленный рейтинг и коментарий"""
|
||||
|
||||
nowrating = RatingStatus.objects.filter(usercom__user_id=self.request.user.id,
|
||||
usercom__time_create__contains=datetime.date.today()
|
||||
).order_by("crit_id")
|
||||
nowcomment = UserComment.objects.filter(user_id=self.request.user.id,
|
||||
time_create__contains=datetime.date.today()
|
||||
)
|
||||
|
||||
nowrating = RatingStatus.objects.filter(
|
||||
usercom__user_id=self.request.user.id, usercom__time_create__contains=datetime.date.today()
|
||||
).order_by("crit_id")
|
||||
nowcomment = UserComment.objects.filter(user_id=self.request.user.id, time_create__contains=datetime.date.today())
|
||||
basecrit = BaseCriteria.objects.all()
|
||||
|
||||
# Сериализуем извлечённый набор записей
|
||||
serializer_for_basecrit = BaseCriteriaAllSerializer(
|
||||
instance=basecrit, # Передаём набор записей
|
||||
many=True # Указываем, что на вход подаётся именно набор записей
|
||||
instance=basecrit, # Передаём набор записей
|
||||
many=True, # Указываем, что на вход подаётся именно набор записей
|
||||
)
|
||||
|
||||
serializer_for_nowcomment = FeedbackUserCommentSerializer(
|
||||
instance=nowcomment, # Передаём набор записей
|
||||
many=True # Указываем, что на вход подаётся именно набор записей
|
||||
instance=nowcomment, # Передаём набор записей
|
||||
many=True, # Указываем, что на вход подаётся именно набор записей
|
||||
)
|
||||
|
||||
serializer_for_nowrating = RatingStatusSerializer(
|
||||
instance=nowrating, # Передаём набор записей , "rat":serializer_for_queryset2.data
|
||||
many=True # Указываем, что на вход подаётся именно набор записей
|
||||
instance=nowrating, # Передаём набор записей , "rat":serializer_for_queryset2.data
|
||||
many=True, # Указываем, что на вход подаётся именно набор записей
|
||||
)
|
||||
|
||||
return Response({"basecrit": serializer_for_basecrit.data,
|
||||
"nowrating": serializer_for_nowrating.data,
|
||||
"nowcomment": serializer_for_nowcomment.data[0] if len(nowcomment)>0 else None
|
||||
})
|
||||
|
||||
|
||||
return Response(
|
||||
{
|
||||
"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):
|
||||
"""Оценка сайта. И добавление или обновление комементария или оценки сайта
|
||||
Параметры
|
||||
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}
|
||||
"""
|
||||
comment, created = UserComment.objects.update_or_create(id = request.data['nowcomment']['id'],
|
||||
user_id = self.request.user.id,
|
||||
defaults = {'comment':request.data['nowcomment']['comment'],
|
||||
'time_create':datetime.datetime.now()
|
||||
})
|
||||
for x in request.data['nowrating']:
|
||||
RatingStatus.objects.update_or_create(id=x['id'],
|
||||
defaults={'rating':x['rating'],
|
||||
'crit_id':x['crit'],
|
||||
'usercom_id':comment.id
|
||||
})
|
||||
comment, created = UserComment.objects.update_or_create(
|
||||
id=request.data["nowcomment"]["id"],
|
||||
user_id=self.request.user.id,
|
||||
defaults={"comment": request.data["nowcomment"]["comment"], "time_create": datetime.datetime.now()},
|
||||
)
|
||||
for x in request.data["nowrating"]:
|
||||
RatingStatus.objects.update_or_create(
|
||||
id=x["id"], defaults={"rating": x["rating"], "crit_id": x["crit"], "usercom_id": comment.id}
|
||||
)
|
||||
return Response({})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Regular → Executable
File mode changed.
Regular → Executable
+2
-3
@@ -1,4 +1,3 @@
|
||||
from django.contrib import admin
|
||||
from .models import *
|
||||
# Register your models here.
|
||||
|
||||
@@ -33,5 +32,5 @@ from .models import *
|
||||
# return super().formfield_for_manytomany(
|
||||
# db_field, request, using=self.using, **kwargs
|
||||
# )
|
||||
|
||||
# admin.site.register(Carousels, MultiDBModelAdmin)
|
||||
|
||||
# admin.site.register(Carousels, MultiDBModelAdmin)
|
||||
Regular → Executable
+2
-2
@@ -2,5 +2,5 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class GarbageConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'garbage'
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "garbage"
|
||||
Regular → Executable
+4
-5
@@ -8,17 +8,16 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
|
||||
class Carousels(models.Model):
|
||||
title = models.CharField(max_length=255)
|
||||
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)
|
||||
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:
|
||||
managed = False
|
||||
db_table = 'carousels'
|
||||
db_table = "carousels"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.title)
|
||||
Regular → Executable
+4
-6
@@ -1,11 +1,9 @@
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from .models import *
|
||||
|
||||
|
||||
|
||||
class CarouselsSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
||||
model = Carousels
|
||||
fields = '__all__'
|
||||
class Meta:
|
||||
model = Carousels
|
||||
fields = "__all__"
|
||||
Regular → Executable
-2
@@ -1,3 +1 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
Regular → Executable
+3
-13
@@ -1,17 +1,7 @@
|
||||
from django.urls import include, path
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from django.urls import path
|
||||
|
||||
from .views import *
|
||||
|
||||
from rest_framework_simplejwt.views import (
|
||||
TokenObtainPairView,
|
||||
TokenRefreshView,TokenVerifyView
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
|
||||
path('links/', CaorusAPIView.as_view(), name='CaorusAPIView'),
|
||||
|
||||
|
||||
]
|
||||
path("links/", CaorusAPIView.as_view(), name="CaorusAPIView"),
|
||||
]
|
||||
Regular → Executable
+6
-4
@@ -1,11 +1,13 @@
|
||||
from django.shortcuts import render
|
||||
from rest_framework.generics import ListAPIView
|
||||
from .models import *
|
||||
from rest_framework.response import Response
|
||||
|
||||
from .models import *
|
||||
from .serializers import *
|
||||
|
||||
|
||||
class CaorusAPIView(ListAPIView):
|
||||
"""Карусель с произвольным набором картинок"""
|
||||
|
||||
def get(self, request):
|
||||
queryset = Carousels.objects.using('add_base').all().order_by('order')
|
||||
return Response(CarouselsSerializer(queryset, many=True).data)
|
||||
queryset = Carousels.objects.using("add_base").all().order_by("order")
|
||||
return Response(CarouselsSerializer(queryset, many=True).data)
|
||||
Regular → Executable
File mode changed.
Regular → Executable
+15
-9
@@ -1,22 +1,28 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import *
|
||||
|
||||
|
||||
class GeneralVacationAdmin(admin.ModelAdmin):
|
||||
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')
|
||||
readonly_fields=('get_name',)
|
||||
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")
|
||||
readonly_fields = ("get_name",)
|
||||
|
||||
def get_name(self, obj):
|
||||
|
||||
return obj.user.fio()
|
||||
|
||||
|
||||
|
||||
class PlanCalendarAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'start_work_period', 'end_work_period')
|
||||
list_filter = ('start_work_period', 'end_work_period')
|
||||
fields = ('name', 'start_work_period', 'end_work_period')
|
||||
list_display = ("name", "start_work_period", "end_work_period")
|
||||
list_filter = ("start_work_period", "end_work_period")
|
||||
fields = ("name", "start_work_period", "end_work_period")
|
||||
|
||||
|
||||
class BasePositionAmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'name', 'order')
|
||||
list_editable = ('order', 'name')
|
||||
list_display = ("id", "name", "order")
|
||||
list_editable = ("order", "name")
|
||||
|
||||
|
||||
# admin.site.register(GeneralVacation, GeneralVacationAdmin),
|
||||
admin.site.register(PlanCalendar, PlanCalendarAdmin)
|
||||
|
||||
Regular → Executable
+2
-3
@@ -2,7 +2,6 @@ from django.apps import AppConfig
|
||||
|
||||
|
||||
class GeneralVacationConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'general_vacation'
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "general_vacation"
|
||||
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