diff --git a/src/bk-user/bkuser/apps/data_source/models.py b/src/bk-user/bkuser/apps/data_source/models.py index bf2e7165d..4bf40979a 100644 --- a/src/bk-user/bkuser/apps/data_source/models.py +++ b/src/bk-user/bkuser/apps/data_source/models.py @@ -8,6 +8,7 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ +import uuid from django.conf import settings from django.db import models @@ -57,7 +58,7 @@ def is_local(self) -> bool: class DataSourceUser(TimestampedModel): data_source = models.ForeignKey(DataSource, on_delete=models.PROTECT, db_constraint=False) - # code = models.CharField("用户标识", max_length=128, default=uuid.uuid4) + code = models.CharField("用户标识", max_length=128, default=uuid.uuid4) # ----------------------- 内置字段相关 ----------------------- username = models.CharField("用户名", max_length=128) @@ -78,7 +79,7 @@ class DataSourceUser(TimestampedModel): class Meta: ordering = ["id"] unique_together = [ - # ("code", "data_source"), + ("code", "data_source"), ("username", "data_source"), ]