我是django的新手,我刚刚在我的项目中安装了django通知。现在我已经设置好了,安装好了,添加了这个信号
notify_send = request.user.profile.get_absolute_url()
notify.send(notify_send, recipient=pending_like, verb='Sent you a friend request' )
当一些用户喜欢另一个用户时,这种方法非常有效,因此我可以查看/inbox/notifications/并看到通知
汤姆史密斯给你发了一个朋友请求
1分钟前
“无”
所以它工作得很完美,但是我如何使它使tomsmith是可点击的,并且查看它的人可以点击名字进入他的个人资料?这是动作对象吗?“无”代表什么?抱歉,如果这是混乱,但我不能得到我的头周围。你知道吗
我有一个名为profiles的profile应用程序
class Profile(models.Model):
user = models.OneToOneField(User)
location = models.CharField(max_length=120, choices=LOCATIONS,null=True, blank=True)
picture = models.ImageField(upload_to=upload_location, null=True, blank=True)
def __unicode__(self):
return self.user.username
def get_absolute_url(self):
url = reverse("profile", kwargs={"username": self.user.username})
return url
def like_link(self):
url = reverse("like_user", kwargs={"id": self.user.id})
return url`
我的错误代码是:
AttributeError at /like/13/ 'unicode' object has no attribute '_meta' Request Method: GET
在回溯中
^{2}$以及
actor_content_type=ContentType.objects.get_for_model(actor),
事先谢谢你的帮助。你知道吗
一种方法是为每个概要文件定义一个^{} (在
Profile
模型中),然后在notify.send
中使用它:但是在通知中,而不是使用tomsmith链接到tomsmith配置文件。你知道吗
编辑
重新定义你的
__unicode__
,比如:相关问题 更多 >
编程相关推荐