1

使用 app django-activity-stream 的人可以通过示例告诉我如何正确使用它吗?阅读文档后,我真的很困惑。

我需要显示我的 modal 中的最后 10 个活动Characterictic。用户可以编辑特征对象,也可以为对象添加注释。

例如

1) User A add comment to Characterictic B in 11:45
2) User B edit Characterictic C in 11:00
3) User C create Characterictic А in 09:55.

模型.py:

class Characteristic(models.Model):
    project = models.ForeignKey(Project, on_delete=models.CASCADE)
    symbol = models.CharField(_('Symbol'), max_length=250)
    description = models.TextField(_('Description'))
    comments = models.ManyToManyField("Comment")
    create_time = models.DateTimeField(_('Date of creation'), auto_now_add=True)
    revision_date = models.DateTimeField(_('Date of last update'), auto_now=True)

class Comment(models.Model):
    author = models.ForeignKey(User, on_delete=models.CASCADE)
    text = models.TextField()
    created = models.DateTimeField(auto_now_add=True)
4

0 回答 0