Browse Source

fix: 修复空库 migrate 的问题

pull/9008/head
ibuler 2 years ago
parent
commit
e6d845ae55
  1. 2
      apps/orgs/mixins/models.py
  2. 9
      apps/orgs/utils.py

2
apps/orgs/mixins/models.py

@ -60,7 +60,7 @@ class OrgModelMixin(models.Model):
sep = '@'
def save(self, *args, **kwargs):
locking_org = getattr(self, 'locking_org', None)
locking_org = getattr(self, 'LOCKING_ORG', None)
if locking_org:
org = Organization.get_instance(locking_org)
else:

9
apps/orgs/utils.py

@ -105,12 +105,11 @@ def tmp_to_builtin_org(system=0, default=0):
def filter_org_queryset(queryset):
locking_org = getattr(queryset.model, 'LOCKING_ORG', None)
if locking_org:
org = Organization.get_instance(locking_org)
else:
org = get_current_org()
org = get_current_org()
if org is None:
if locking_org:
kwargs = {'org_id': locking_org}
elif org is None:
kwargs = {}
elif org.is_root():
kwargs = {}

Loading…
Cancel
Save