fix: 修改默认组织 builtin 字段处理问题

pull/8997/head
Jiangjie.Bai 2022-10-27 16:49:22 +08:00
parent 5d37d1b7b1
commit e4d372be32
1 changed files with 4 additions and 1 deletions

View File

@ -140,7 +140,10 @@ class Organization(OrgRoleMixin, models.Model):
@classmethod
def default(cls):
defaults = dict(id=cls.DEFAULT_ID, name=cls.DEFAULT_NAME)
obj, created = cls.objects.get_or_create(defaults=defaults, id=cls.DEFAULT_ID, builtin=True)
obj, created = cls.objects.get_or_create(defaults=defaults, id=cls.DEFAULT_ID)
if not obj.builtin:
obj.builtin = True
obj.save()
return obj
@classmethod