新功能: 顶部加入消息通知图标

pull/79/head
猿小天 2022-11-17 17:12:13 +08:00
parent 1f8c54a101
commit b18e35b388
3 changed files with 8 additions and 5 deletions

View File

@ -1,8 +1,5 @@
# -*- coding: utf-8 -*-
from django.urls import path
from application.websocketConfig import MegCenter
websocket_urlpatterns = [

View File

@ -93,6 +93,7 @@ TEMPLATES = [
WSGI_APPLICATION = "application.wsgi.application"
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
@ -168,7 +169,7 @@ CORS_ALLOW_CREDENTIALS = True # 指明在跨域访问中,后端是否支持
# ================================================= #
# ********************* channels配置 ******************* #
# ================================================= #
ASGI_APPLICATION = 'application.routing.application'
ASGI_APPLICATION = 'application.asgi.application'
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels.layers.InMemoryChannelLayer"

View File

@ -7,6 +7,7 @@ from openpyxl import Workbook
from openpyxl.worksheet.datavalidation import DataValidation
from openpyxl.utils import get_column_letter, quote_sheetname
from openpyxl.worksheet.table import Table, TableStyleInfo
from rest_framework.decorators import action
from rest_framework.request import Request
from dvadmin.utils.import_export import import_to_data
@ -56,6 +57,7 @@ class ImportSerializerMixin:
length += 2.1 if ord(char) > 256 else 1
return round(length, 1) if length <= self.export_column_width else self.export_column_width
@action(methods=['get','post'],detail=False)
@transaction.atomic # Django 事务,防止出错
def import_data(self, request: Request, *args, **kwargs):
"""
@ -151,8 +153,11 @@ class ImportSerializerMixin:
if queryset.model._meta.unique_together: # 判断是否存在联合主键
filter_dic = {i: ele.get(i) for i in list(queryset.model._meta.unique_together[0])}
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()
print(unique_list)
print(filter_dic)
print(instance)
if instance and not updateSupport:
continue
if not filter_dic: