fix: 修复 json m2m field 中正则有问题匹配不正确

pull/11034/head
ibuler 2023-07-20 14:46:56 +08:00 committed by Bryan
parent 19b91a6c1f
commit 08bc3d14aa
4 changed files with 18 additions and 12 deletions

View File

@ -387,7 +387,7 @@ class RelatedManager:
lookup = "{}__{}".format(name, match) lookup = "{}__{}".format(name, match)
q = Q(**{lookup: val}) q = Q(**{lookup: val})
except re.error: except re.error:
q = ~Q() q = Q(pk__isnull=True)
elif match == "not": elif match == "not":
q = ~Q(**{name: val}) q = ~Q(**{name: val})
elif match in ['m2m', 'in']: elif match in ['m2m', 'in']:

View File

@ -1,25 +1,25 @@
# ~*~ coding: utf-8 ~*~ # ~*~ coding: utf-8 ~*~
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from datetime import timedelta
from collections import defaultdict from collections import defaultdict
from datetime import timedelta
from django.db.transaction import atomic
from django.conf import settings
from celery import shared_task from celery import shared_task
from django.conf import settings
from django.db.transaction import atomic
from django.utils.translation import gettext_lazy as _
from ops.celery.decorator import register_as_period_task from common.const.crontab import CRONTAB_AT_AM_TEN
from orgs.utils import tmp_to_root_org
from common.utils import get_logger from common.utils import get_logger
from common.utils.timezone import local_now, dt_parser from common.utils.timezone import local_now, dt_parser
from common.const.crontab import CRONTAB_AT_AM_TEN from ops.celery.decorator import register_as_period_task
from orgs.utils import tmp_to_root_org
from perms.models import AssetPermission from perms.models import AssetPermission
from perms.utils import UserPermTreeExpireUtil
from perms.notifications import ( from perms.notifications import (
PermedAssetsWillExpireUserMsg, PermedAssetsWillExpireUserMsg,
AssetPermsWillExpireForOrgAdminMsg, AssetPermsWillExpireForOrgAdminMsg,
) )
from django.utils.translation import gettext_lazy as _ from perms.utils import UserPermTreeExpireUtil
logger = get_logger(__file__) logger = get_logger(__file__)
@ -32,7 +32,8 @@ def check_asset_permission_expired():
""" 这里的任务要足够短,不要影响周期任务 """ """ 这里的任务要足够短,不要影响周期任务 """
perms = AssetPermission.objects.get_expired_permissions() perms = AssetPermission.objects.get_expired_permissions()
perm_ids = list(perms.distinct().values_list('id', flat=True)) perm_ids = list(perms.distinct().values_list('id', flat=True))
logger.info(f'Checking expired permissions: {perm_ids}') show_perm_ids = perm_ids[:5]
logger.info(f'Checking expired permissions: {show_perm_ids} ...')
UserPermTreeExpireUtil().expire_perm_tree_for_perms(perm_ids) UserPermTreeExpireUtil().expire_perm_tree_for_perms(perm_ids)

View File

@ -79,6 +79,7 @@ class DBPortManager(object):
for port, db_id in mapper.items(): for port, db_id in mapper.items():
if db_id == str(db.id): if db_id == str(db.id):
return port return port
if raise_exception: if raise_exception:
error = _( error = _(
'No available port is matched. ' 'No available port is matched. '

View File

@ -1,6 +1,6 @@
# Install cryptography error: build/temp.macosx-10.13-intel-2.7/_openssl.c:483:10: fatal error: 'openssl/opensslv.h' file not found # Install cryptography error: build/temp.macosx-10.13-intel-2.7/_openssl.c:483:10: fatal error: 'openssl/opensslv.h' file not found
$ pip install cryptography --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include" $ pip install cryptography --global-option=build_ext --global-option="-L/opt/homebrew/Cellar/openssl@3/3.1.1_1/lib" --global-option="-I/opt/homebrew/Cellar/openssl@3/3.1.1_1/include"
# Pillow zlib failed # Pillow zlib failed
@ -9,3 +9,7 @@ Reinstall xcode reslove
$ xcode-select --install $ xcode-select --install
# libxmlsec 报错
wget 'https://raw.githubusercontent.com/Homebrew/homebrew-core/7f35e6ede954326a10949891af2dba47bbe1fc17/Formula/libxmlsec1.rb'
brew install ./libxmlsec1.rb