fix: stabilize profile name migration and parser validation imports
Some checks failed
CI/CD Pipeline / Telegram Notify Success (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Telegram Notify Success (pull_request) Has been cancelled
CI/CD Pipeline / Code Quality Checks (pull_request) Has been cancelled
CI/CD Pipeline / Run Tests (pull_request) Has been cancelled
Some checks failed
CI/CD Pipeline / Telegram Notify Success (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Telegram Notify Success (pull_request) Has been cancelled
CI/CD Pipeline / Code Quality Checks (pull_request) Has been cancelled
CI/CD Pipeline / Run Tests (pull_request) Has been cancelled
This commit is contained in:
@@ -285,7 +285,9 @@ class BackgroundJobStreamView(BackgroundJobStatusView):
|
||||
"task_id": job.task_id,
|
||||
"status": "error",
|
||||
"progress": job.progress,
|
||||
"message": job.error or job.progress_message or "Задача завершилась с ошибкой",
|
||||
"message": job.error
|
||||
or job.progress_message
|
||||
or "Задача завершилась с ошибкой",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ from apps.parsers.models import (
|
||||
IndustrialProductRecord,
|
||||
InspectionRecord,
|
||||
ManufacturerRecord,
|
||||
ParsingSettings,
|
||||
ParserLoadLog,
|
||||
ParsingSettings,
|
||||
ProcurementRecord,
|
||||
Proxy,
|
||||
)
|
||||
|
||||
@@ -11,9 +11,9 @@ from apps.parsers.views import (
|
||||
IndustrialProductViewSet,
|
||||
InspectionViewSet,
|
||||
ManufacturerViewSet,
|
||||
ParsingSettingsView,
|
||||
ParserLoadLogExportView,
|
||||
ParserLoadLogViewSet,
|
||||
ParsingSettingsView,
|
||||
ProcurementViewSet,
|
||||
ProxyViewSet,
|
||||
SourceCardDetailView,
|
||||
|
||||
@@ -16,8 +16,8 @@ from apps.parsers.models import (
|
||||
IndustrialProductRecord,
|
||||
InspectionRecord,
|
||||
ManufacturerRecord,
|
||||
ParsingSettings,
|
||||
ParserLoadLog,
|
||||
ParsingSettings,
|
||||
ProcurementRecord,
|
||||
Proxy,
|
||||
)
|
||||
@@ -28,10 +28,10 @@ from apps.parsers.serializers import (
|
||||
IndustrialCertificateSerializer,
|
||||
IndustrialProductSerializer,
|
||||
InspectionSerializer,
|
||||
ParserLoadLogListSerializer,
|
||||
ParsingSettingsSerializer,
|
||||
ManufacturerSerializer,
|
||||
ParserLoadLogListSerializer,
|
||||
ParserLoadLogSerializer,
|
||||
ParsingSettingsSerializer,
|
||||
ProcurementSerializer,
|
||||
ProxySerializer,
|
||||
SourceCardDetailSerializer,
|
||||
@@ -48,6 +48,7 @@ from django.http import HttpResponse
|
||||
from drf_yasg import openapi
|
||||
from drf_yasg.utils import swagger_auto_schema
|
||||
from rest_framework import status
|
||||
from rest_framework.exceptions import ValidationError
|
||||
from rest_framework.parsers import MultiPartParser
|
||||
from rest_framework.permissions import IsAdminUser, IsAuthenticated
|
||||
from rest_framework.response import Response
|
||||
@@ -170,7 +171,9 @@ def _paginate_results(request, rows: list[dict]):
|
||||
page_number = max(1, int(page_raw))
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise ValidationError(
|
||||
{"detail": "Параметры page и page_size должны быть положительными целыми числами."}
|
||||
{
|
||||
"detail": "Параметры page и page_size должны быть положительными целыми числами."
|
||||
}
|
||||
) from exc
|
||||
|
||||
paginator = Paginator(rows, page_size)
|
||||
@@ -1041,7 +1044,10 @@ class ParserLoadLogExportView(APIView):
|
||||
},
|
||||
)
|
||||
def get(self, request):
|
||||
rows = [_serialize_parser_log_row(item) for item in _apply_parser_log_filters(request)]
|
||||
rows = [
|
||||
_serialize_parser_log_row(item)
|
||||
for item in _apply_parser_log_filters(request)
|
||||
]
|
||||
search_term = request.query_params.get("search", "").strip()
|
||||
if search_term:
|
||||
rows = [row for row in rows if _matches_parser_log_search(row, search_term)]
|
||||
|
||||
@@ -26,6 +26,8 @@ def backfill_profile_names(apps, schema_editor):
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
atomic = False
|
||||
|
||||
dependencies = [
|
||||
("user", "0009_alter_user_groups"),
|
||||
]
|
||||
|
||||
@@ -258,9 +258,7 @@ class AdminUserUpdateSerializer(serializers.ModelSerializer):
|
||||
required=False,
|
||||
help_text="Прикладная роль пользователя",
|
||||
)
|
||||
first_name = serializers.CharField(
|
||||
required=False, allow_blank=True
|
||||
)
|
||||
first_name = serializers.CharField(required=False, allow_blank=True)
|
||||
middle_name = serializers.CharField(
|
||||
required=False,
|
||||
allow_blank=True,
|
||||
|
||||
@@ -5,7 +5,10 @@ from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.models import Group
|
||||
from django.db import transaction
|
||||
from django.db.models import F, Q
|
||||
from rest_framework_simplejwt.token_blacklist.models import BlacklistedToken, OutstandingToken
|
||||
from rest_framework_simplejwt.token_blacklist.models import (
|
||||
BlacklistedToken,
|
||||
OutstandingToken,
|
||||
)
|
||||
from rest_framework_simplejwt.tokens import RefreshToken
|
||||
|
||||
from .models import Profile
|
||||
|
||||
Reference in New Issue
Block a user