[Update] Merge with dev

This commit is contained in:
ibuler
2019-10-21 15:19:21 +08:00
55 changed files with 610 additions and 277 deletions

View File

@@ -8,7 +8,7 @@ from django.core.exceptions import ValidationError
from common.utils import get_logger
from ..utils import (
set_current_org, get_current_org, current_org,
filter_org_queryset,
filter_org_queryset
)
from ..models import Organization
@@ -48,9 +48,12 @@ class OrgModelMixin(models.Model):
def save(self, *args, **kwargs):
org = get_current_org()
if org is not None and (org.is_real() or org.is_system()):
if org is None:
return super().save(*args, **kwargs)
if org.is_real() or org.is_system():
self.org_id = org.id
elif org is not None and org.is_default():
elif org.is_default():
self.org_id = ''
return super().save(*args, **kwargs)