From ba3838c184b3098a618e169e2bab8802e4a389b2 Mon Sep 17 00:00:00 2001 From: Tony Kim Date: Mon, 5 Feb 2024 21:52:40 +0900 Subject: [PATCH] REVIEW: review --- server/apps/communitys/views.py | 8 ++++++++ server/apps/games/views.py | 1 + 2 files changed, 9 insertions(+) diff --git a/server/apps/communitys/views.py b/server/apps/communitys/views.py index fb45e17..34b65c9 100644 --- a/server/apps/communitys/views.py +++ b/server/apps/communitys/views.py @@ -210,6 +210,7 @@ def post_detail(request, pk, bid): # all_post = user.post_set.all() # HTML 에 전달할 정보 + # Tony: Post에 Foreign Key로 묶여져있어서, post 객체만 전달해도 comments, liked, scraped 정보 전달이 가능하지 않나요? context = { "post" : post, "bid" : bid, @@ -236,6 +237,7 @@ def post_detail(request, pk, bid): def comment_create(request): print(request.body) req = json.loads(request.body) + # Tony: 만약 키에 해당하는 값이 없으면 에러가 발생하지 않나요? post_id = req["post_id"] content = req["content"] commenter = request.user @@ -254,6 +256,7 @@ def comment_create(request): @transaction.atomic def reply_create(request): req = json.loads(request.body) + # Tony: 만약 키에 해당하는 값이 없으면 에러가 발생하지 않나요? post_id = req["post_id"] content = req["content"] parent_comment_id = req["parent_comment_id"] @@ -289,6 +292,7 @@ def reply_list(request): @transaction.atomic def comment_delete(request, pk): req = json.loads(request.body) + # Tony: 만약 키에 해당하는 값이 없으면 에러가 발생하지 않나요? cid = req["comment_id"] try: @@ -306,6 +310,7 @@ def comment_delete(request, pk): @transaction.atomic def comment_update(request, pk): req = json.loads(request.body) + # Tony: 만약 키에 해당하는 값이 없으면 에러가 발생하지 않나요? cid = req["comment_id"] content = req["content"] @@ -332,6 +337,7 @@ def comment_update(request, pk): # 기능 : 게시글 좋아요 @csrf_exempt @transaction.atomic +# Tony: CamelCase vs snake_head 명명법 def pushPostLike(request): req = json.loads(request.body) post_id = req["post_id"] @@ -360,6 +366,7 @@ def pushPostLike(request): # 기능 : 게시글 좋아요 @csrf_exempt @transaction.atomic +# Tony: CamelCase vs snake_head 명명법 def pushCommentLike(request): pass @@ -369,6 +376,7 @@ def pushCommentLike(request): ########################################################### @csrf_exempt @transaction.atomic +# Tony: CamelCase vs snake_head 명명법 def pushScrap(request): req = json.loads(request.body) post_id = req["post_id"] diff --git a/server/apps/games/views.py b/server/apps/games/views.py index d150917..bf77a4f 100644 --- a/server/apps/games/views.py +++ b/server/apps/games/views.py @@ -76,6 +76,7 @@ def game_detail(request, game_id, round_count, player_count): for round in rounds: # 파 데이터 받아 넘겨주기 par_data = round.par + # Tony: 9홀이 끝인가요?? for i in range(1, 10): hole_key = f'hole{i}' par_data[hole_key] = int(request.POST.get(f'par{i}_{round.id}', 0))