Content Comment Design
来源:互联网 发布:java电脑版86安装包 编辑:程序博客网 时间:2024/05/01 03:59
需求
对其他用户发布的内容进行评论
设计
Model
Comment
字段
- entity_ref ForeignKey 外键 要评论的实体
- author ForeignKey 外键 作者
- content CharField 内容
- pub_date DateTimeField 评论时间
描述
对一条用户发布的内容,其他用户可以发一条至多条评论。需要记录发布评论针对的内容信息(内容表的唯一id做外键),那个用户发布的评论(用户表唯一id做外键),评论的内容,评论的时间。
CRUD
用户可以撰写,修改,删除,查看自己的评论。但是不支持修改。删除时因为用户可以对1条内容发布多条评论,而且内容可能重复,所以一旦用户删除内容相同的的多条评论中的一条那么,如果不传入时间参数的话,那其他评论就会被删除。但是用户的意图只是删除其中一条。
方法
def get(cls, comment_id): passdef get_comments(cls, content_id, user_id): return Comment.objects.filter(content__id=content_id, user__id=user_id)def get_comments_by_content(cls, content_id): return Comment.objects.filter(content__id=content_id)
0 0
- Content Comment Design
- use a Content action handlers to add comment for node
- Comment
- comment
- comment
- The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tupli
- The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tupli
- The content of element type "configuration" must match "EMPTY". Children of type "comment" are not a
- Content and Complexity: Information Design in Technical Communication
- Cloud Design Pattern - Static Content Hosting Pattern(静态内容托管)
- Pass4Sure Cisco Content Networking 642-961 also called Cisco Data Center Networking Infrastructure Solutions design is a Content
- Pass4Sure Cisco Content Networking 642-961 also called Cisco Data Center Networking Infrastructure Solutions design is a Content
- content
- Content
- content
- Content
- Content
- comment.c
- msp430的printf函数的简单移植
- IEEE极限编程之The pipeline-动态规划思想
- LeetCode *** 209. Minimum Size Subarray Sum
- ubuntu 部署L2TP亲测
- 剑指Offer——二维数组查找
- Content Comment Design
- 彻底解决_OBJC_CLASS_$_某文件名", referenced from:问题(转)
- 通过sqli-labs学习sql注入——基础挑战之less1-10
- fragment 里面 内嵌 fragment
- urllib2使用总结
- hdfs的基本原理和基本操作总结
- Bochs虚拟机debug指令
- mvn install时Premature end of Content-Length delimited message body错误
- 免费的论文查重网站