class UserAttention(models.Model):
"""
用户关注
"""
user = models.ForeignKey(User, verbose_name="用户")
userid = models.CharField(max_length=32,verbose_name="关注会员的id", help_text="关注会员的id")
add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间")
class Meta:
verbose_name = '用户关注'
verbose_name_plural = verbose_name
unique_together = ("user", "userid")#做一个联合唯一的验证,数据库验证,如果重复就会报错