如何使用 django_comments 从 Django GetStream 保存活动以及如何获取这些数据?谢谢!
我已经使用 render_comment_form 实现了 Django 注释,类似于https://django.readthedocs.org/en/1.4.X/ref/contrib/comments/我想知道如何在 GetStream 中保存活动以及如何保存保存后我会咨询谢谢谢谢你,但我有这样的事情:
from django.db import models
from fluent_comments.compat import CommentManager, Comment #, signals
from fluent_comments.models import FluentComment
from stream_django.activity import Activity
from stream_django import feed_manager
from django.db.models import signals
from publications.models import Ad
class ActivityComments(FluentComment, Activity):
pass
def __unicode__(self):
#return "%s COMENTA-->> %s" % (self.user.first_name, self.object_content.item)
return "%s COMENTA-->> %s" % (self.user.first_name, self.object_pk)
@property
def activity_object_attr(self):
return self
@property
def activity_actor_attr(self):
return self.user
@property
def activity_time(self):
return self.created
@property
def extra_activity_data(self):
return {'a': self.item}
@property
def activity_notify(self):
if self.object_content.item.seller.user != self.user:
target_feed = feed_manager.get_notification_feed(
self.object_content.item.seller.user.id)
return [target_feed]
@classmethod
def apply_activity_notify(cls, sender, instance, using, **kwargs):
ad=Ad.objects.get(id=instance.object_pk)
comment = FluentComment.objects.get(id=instance.id)
comment.object_content = ad
comment.activity_notify
"""
signals
"""
signals.post_save.connect(ActivityComments.apply_activity_notify, sender=Comment)
我认为这样我可以注册活动,但是当我去 getstram 管理员时,我什么也不能。另外,另一个问题,当注册已经完成时,我可以用它来获得活动吗?:
enricher = Enrich()
feed = feed_manager.get_feed('flat', user.id)
activities = feed.get(limit=3)['results']
I hope your answer, Thanks.