新功能: 顶部加入消息通知图标
parent
1f8c54a101
commit
b18e35b388
|
@ -1,8 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from application.websocketConfig import MegCenter
|
from application.websocketConfig import MegCenter
|
||||||
|
|
||||||
websocket_urlpatterns = [
|
websocket_urlpatterns = [
|
||||||
|
|
|
@ -93,6 +93,7 @@ TEMPLATES = [
|
||||||
|
|
||||||
WSGI_APPLICATION = "application.wsgi.application"
|
WSGI_APPLICATION = "application.wsgi.application"
|
||||||
|
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
||||||
|
|
||||||
|
@ -168,7 +169,7 @@ CORS_ALLOW_CREDENTIALS = True # 指明在跨域访问中,后端是否支持
|
||||||
# ================================================= #
|
# ================================================= #
|
||||||
# ********************* channels配置 ******************* #
|
# ********************* channels配置 ******************* #
|
||||||
# ================================================= #
|
# ================================================= #
|
||||||
ASGI_APPLICATION = 'application.routing.application'
|
ASGI_APPLICATION = 'application.asgi.application'
|
||||||
CHANNEL_LAYERS = {
|
CHANNEL_LAYERS = {
|
||||||
"default": {
|
"default": {
|
||||||
"BACKEND": "channels.layers.InMemoryChannelLayer"
|
"BACKEND": "channels.layers.InMemoryChannelLayer"
|
||||||
|
|
|
@ -7,6 +7,7 @@ from openpyxl import Workbook
|
||||||
from openpyxl.worksheet.datavalidation import DataValidation
|
from openpyxl.worksheet.datavalidation import DataValidation
|
||||||
from openpyxl.utils import get_column_letter, quote_sheetname
|
from openpyxl.utils import get_column_letter, quote_sheetname
|
||||||
from openpyxl.worksheet.table import Table, TableStyleInfo
|
from openpyxl.worksheet.table import Table, TableStyleInfo
|
||||||
|
from rest_framework.decorators import action
|
||||||
from rest_framework.request import Request
|
from rest_framework.request import Request
|
||||||
|
|
||||||
from dvadmin.utils.import_export import import_to_data
|
from dvadmin.utils.import_export import import_to_data
|
||||||
|
@ -56,6 +57,7 @@ class ImportSerializerMixin:
|
||||||
length += 2.1 if ord(char) > 256 else 1
|
length += 2.1 if ord(char) > 256 else 1
|
||||||
return round(length, 1) if length <= self.export_column_width else self.export_column_width
|
return round(length, 1) if length <= self.export_column_width else self.export_column_width
|
||||||
|
|
||||||
|
@action(methods=['get','post'],detail=False)
|
||||||
@transaction.atomic # Django 事务,防止出错
|
@transaction.atomic # Django 事务,防止出错
|
||||||
def import_data(self, request: Request, *args, **kwargs):
|
def import_data(self, request: Request, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -151,8 +153,11 @@ class ImportSerializerMixin:
|
||||||
if queryset.model._meta.unique_together: # 判断是否存在联合主键
|
if queryset.model._meta.unique_together: # 判断是否存在联合主键
|
||||||
filter_dic = {i: ele.get(i) for i in list(queryset.model._meta.unique_together[0])}
|
filter_dic = {i: ele.get(i) for i in list(queryset.model._meta.unique_together[0])}
|
||||||
else:
|
else:
|
||||||
filter_dic = {i: ele.get(i) for i in list(set(self.import_field_dict.keys()) & set(unique_list))}
|
filter_dic = {i: ele.get(i) for i in list(set(unique_list)) if ele.get(i) is not None}
|
||||||
instance = filter_dic and queryset.filter(**filter_dic).first()
|
instance = filter_dic and queryset.filter(**filter_dic).first()
|
||||||
|
print(unique_list)
|
||||||
|
print(filter_dic)
|
||||||
|
print(instance)
|
||||||
if instance and not updateSupport:
|
if instance and not updateSupport:
|
||||||
continue
|
continue
|
||||||
if not filter_dic:
|
if not filter_dic:
|
||||||
|
|
Loading…
Reference in New Issue