refactor(orgs): 重构组织与用户关系接口

This commit is contained in:
xinwen
2020-08-03 16:17:46 +08:00
committed by 老广
parent f0d564180c
commit c3c5801d2e
11 changed files with 100 additions and 57 deletions

View File

@@ -12,11 +12,12 @@
import uuid
from django.db.models import *
from django.db.models.functions import Concat
from django.utils.translation import ugettext_lazy as _
class Choice(str):
def __new__(cls, value, label):
def __new__(cls, value, label=''): # `deepcopy` 的时候不会传 `label`
self = super().__new__(cls, value)
self.label = label
return self
@@ -77,3 +78,7 @@ class JMSModel(JMSBaseModel):
class Meta:
abstract = True
def concated_display(name1, name2):
return Concat(F(name1), Value('('), F(name2), Value(')'))