首页 > 其他 > 详细

1911A:评论模块表结构分析

时间:2020-11-09 09:54:13      阅读:22      评论:0      收藏:0      [点我收藏+]

1.评论模块表结构

ID

课程---》课程表

发布品论用户---》用户表

品论内容

评论时间

被回复的用户-----》用户表

对哪个品论进行回复的ID-----》当前这个品论表

class Comment(Base):
    user = models.ForeignKey(user.User,on_delete=models.CASCADE,
related_name=user)
    course =
models.ForeignKey(course.Course,on_delete=models.CASCADE,related_name=comment
)
    to_user =
models.ForeignKey(user.User,on_delete=models.CASCADE,related_name=to_user,nul
l=True,blank=True)
    fid = models.ForeignKey(self,on_delete=models.CASCADE,null=True,blank=True)
    content = models.TextField()
    def __str__(self):
        return %s--%s%(self.user.username,self.content)

技术分享图片

 

 

comment_list: [
    {
        "id":1,
        "fid":‘‘,
        "content":"用户tom第一次评论",
        "user":"tom",
        "to_user":"tom"
    },
    {
        "id":2,
        "fid":1,
        "content":"用户张三回复tom的评论内容",
        "user":"zhangsan",
        "to_user":"tom"
    },
    {
        "id":3,
        "fid":2,
        "content":"用户tom又回复了zhangsan的评论",
        "user":"tom",
        "to_user":"zhangsan"
    },
]

 

1911A:评论模块表结构分析

原文:https://www.cnblogs.com/han0911/p/13946756.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!