如何通过django-activity-stream app在模态中显示用户活动?

时间:2017-06-01 03:26:18

标签: python django python-3.x django-1.10 django-activity-stream

使用应用django-activity-stream的人是否可以通过示例告诉我如何正确使用它?阅读完文档后,我真的很感激。

我需要显示我的模态Characterictic中的最后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.

models.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)

0 个答案:

没有答案