models.py:
class posts(models.Model):
topic=models.CharField(max_length=50)
body=models.TextField()
datetime=models.DateTimeField()
name=models.ForeignKey(users)
def __unicode__(self):
return self.topic
class comments(models.Model):
topic=models.ForeignKey(posts)
name=models.ForeignKey(users)
datetime=models.DateTimeField()
body=models.TextField()
def post_detail(request, post_id):
post_data = posts.objects.get(pk=post_id)
#topic_id = topic.posts
comment_data = post_id.comments_set.all()
return render_to_response('details.html',{'post_data':post_data,})
Exception Type: AttributeError
Exception Value: ‘unicode’ object has no attribute ‘comments_set’
где не прав?