优化模型字段
This commit is contained in:
parent
287ed16fb1
commit
09532ca7a5
@ -1,5 +1,8 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
import uuid
|
import uuid
|
||||||
|
from accounts.models import User
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
class CreatorProfile(models.Model):
|
class CreatorProfile(models.Model):
|
||||||
"""达人信息模型,用于筛选功能"""
|
"""达人信息模型,用于筛选功能"""
|
||||||
# 基本信息
|
# 基本信息
|
||||||
@ -154,7 +157,7 @@ class CreatorProfile(models.Model):
|
|||||||
|
|
||||||
class Brand(models.Model):
|
class Brand(models.Model):
|
||||||
"""品牌模型"""
|
"""品牌模型"""
|
||||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
id = models.AutoField(primary_key=True) # 改为int自增主键
|
||||||
name = models.CharField(max_length=100, unique=True, verbose_name='品牌名称')
|
name = models.CharField(max_length=100, unique=True, verbose_name='品牌名称')
|
||||||
description = models.TextField(blank=True, null=True, verbose_name='品牌描述')
|
description = models.TextField(blank=True, null=True, verbose_name='品牌描述')
|
||||||
logo_url = models.CharField(max_length=255, blank=True, null=True, verbose_name='品牌Logo')
|
logo_url = models.CharField(max_length=255, blank=True, null=True, verbose_name='品牌Logo')
|
||||||
@ -185,7 +188,7 @@ class Brand(models.Model):
|
|||||||
|
|
||||||
class Product(models.Model):
|
class Product(models.Model):
|
||||||
"""产品模型 - 作为一个知识库"""
|
"""产品模型 - 作为一个知识库"""
|
||||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
id = models.AutoField(primary_key=True) # 改为int自增主键
|
||||||
brand = models.ForeignKey(Brand, on_delete=models.CASCADE, related_name='products', verbose_name='所属品牌')
|
brand = models.ForeignKey(Brand, on_delete=models.CASCADE, related_name='products', verbose_name='所属品牌')
|
||||||
name = models.CharField(max_length=100, verbose_name='产品名称')
|
name = models.CharField(max_length=100, verbose_name='产品名称')
|
||||||
description = models.TextField(blank=True, null=True, verbose_name='产品描述')
|
description = models.TextField(blank=True, null=True, verbose_name='产品描述')
|
||||||
@ -251,6 +254,7 @@ class CreatorProductMatch(models.Model):
|
|||||||
product = models.ForeignKey('Product', on_delete=models.CASCADE, verbose_name='产品')
|
product = models.ForeignKey('Product', on_delete=models.CASCADE, verbose_name='产品')
|
||||||
is_matched = models.BooleanField(default=False, verbose_name='是否匹配')
|
is_matched = models.BooleanField(default=False, verbose_name='是否匹配')
|
||||||
match_score = models.FloatField(blank=True, null=True, verbose_name='匹配度分数')
|
match_score = models.FloatField(blank=True, null=True, verbose_name='匹配度分数')
|
||||||
|
create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ('creator', 'product')
|
unique_together = ('creator', 'product')
|
||||||
@ -276,7 +280,8 @@ class Dataset(models.Model):
|
|||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
|
|
||||||
# 创建该数据集的用户,最长100个字符,不能为空
|
# 创建该数据集的用户,最长100个字符,不能为空
|
||||||
user = models.CharField(max_length=100)
|
# user = models.CharField(max_length=100)
|
||||||
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
|
|
||||||
# 任务类型,最长50个字符,不能为空
|
# 任务类型,最长50个字符,不能为空
|
||||||
task_type = models.CharField(max_length=16)
|
task_type = models.CharField(max_length=16)
|
||||||
|
Loading…
Reference in New Issue
Block a user