Answer the question
In order to leave comments, you need to log in
How to select a specific comment on a page?
Now I'm making a like button on the comments in the article.
Situation:
An article model - a model with comments is attached to it via ForeignKey.
In the view, it's all output like this:
def video(request, video_id):
videoitem = Video.objects.get(id = video_id) #контент статьи
comview = Video_com.objects.filter(video_link_id=video_id) #комментарии к статье выводятся на страницу через цикл
context = {
"videoitem" : videoitem,
"comview" : comview,
}
return render(request, 'faceset/videopage.html', context)
url(r'^upvideocomlike(?P<add_id>[0-9]+)$', views.upvideocomlike, name='upvideocomlike'),
url(r'^downvideocomlike(?P<add_id>[0-9]+)$', views.downvideocomlike, name='downvideocomlike'),
Answer the question
In order to leave comments, you need to log in
Oscar Django
example:
there is video.id = 1, it has two comments (id=1, id=2),
there is video.id = 2, it has three comments (id=3, id=4, id=5).
You just need to pass only the comment id, because all comments are stored in the same table and they cannot have the same id, regardless of which video they belong to
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question