Closed sunsuking closed 3 years ago
from django.shortcuts import render
from .models import Video, VideoLike, Category, CommentLike, CommentDisLike, VideoDisLike, Comment, Tag
def primary_inner(request):
if request.method == 'GET':
video = Video.objects.get(pk=request.get.id)
category = Category.objects.get(pk=video.pk)
tag = Tag.objects.get(pk=video.pk)
comment = Comment.objects.get(pk=video.pk)
comment_like = CommentLike.objects.filter(comment=comment.pk)
comment_dis_like = CommentDisLike.objects.filter(comment=comment.pk)
return render(request, 'template/primary_inner.html', {
'video': video,
'category': category,
'tag': tag,
'comment': comment
'clike': comment_like,
'cdislike': comment_dis_like
})
def secondary(request):
if request.method == 'GET':
related = Video.objects.all()
video_like = VideoLike.objects.filter(video=related.pk)
video_dis_like = VideoDisLike.objects.filter(video=related.pk)
return render(request, 'template/related.html', {
'related': related,
'vlike': video_like,
'vdislike': video_dis_like
})
127.0.0.1:8000/watch/1 -> 비디오랑 유저 정보 127.0.0.1:8000/watch/1/next -> 추가 영상 127.0.0.1:8000/watch/1/comments -> 댓글
How can I subscribe in channel
watch page 구성: [ video: { "uploader": , "category": , "title": , "tags": , "thumbnail": , "video": , "run_time": , "watch_count": , "description": , "video_like": , "video_dis_like": }, -> video_like등등은 각자 테이블에서 갯수를 추적. uploader: { "user": , "user-image": , "subcribe_count": } -> subcribe_count: subcirbe라는 테이블에서 구독자의 갯수를 추적, comments: [ { "commenter": , "comment_like": , "comment_dis_like": , "comment": }, { "commenter": , "comment_like": , "comment_dis_like": , "comment": }, { "commenter": , "comment_like": , "comment_dis_like": , "comment": } -> comment_like는 테이블에서 갯수를 추적. ], plus_video: [ { "uploader": , "title": , "thumbnail": , "video": , "run_time": , "watch_count": }, { "uploader": , "title": , "thumbnail": , "video": , "run_time": , "watch_count": }, { "uploader": , "title": , "thumbnail": , "video": , "run_time": , "watch_count": } ]
]