Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions server/apps/communitys/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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"]
Expand Down Expand Up @@ -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:
Expand All @@ -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"]

Expand All @@ -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"]
Expand Down Expand Up @@ -360,6 +366,7 @@ def pushPostLike(request):
# 기능 : 게시글 좋아요
@csrf_exempt
@transaction.atomic
# Tony: CamelCase vs snake_head 명명법
def pushCommentLike(request):
pass

Expand All @@ -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"]
Expand Down
1 change: 1 addition & 0 deletions server/apps/games/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down