Skip to content

Assignment for 7 weeks#34

Open
rannie-kim wants to merge 15 commits into
snulion11th-seminar:rangyeongfrom
rannie-kim:rangyeong
Open

Assignment for 7 weeks#34
rannie-kim wants to merge 15 commits into
snulion11th-seminar:rangyeongfrom
rannie-kim:rangyeong

Conversation

@rannie-kim

@rannie-kim rannie-kim commented Apr 29, 2023

Copy link
Copy Markdown
Contributor

[세미나]
Study 7 week : 7주차 세미나때 한 거

[과제]
Make layers of Comment Model : 코데 전에 혼자 해본 것
Submit 7 weeks assignment : 코데 날 마무리 한 것
Modify Post model thanks to hojoon : 호준이가 피드백 해줘서 코드 수정!

나영언니의 공지를 보기 전에 이미 PR 을 날려두었어서, 요렇게 보냅니다..ㅠ.ㅠ

@rannie-kim rannie-kim changed the title Study 7 weeks Assignment for 7 weeks Apr 29, 2023

@BDlhj BDlhj left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR 뿐만 아니라 주석도 열심히 작성해줬군요!!
덕분에 편했습니다ㅎㅎ 심화과제까지 하느라 수고 많았어요~~👏🏻👏🏻👏🏻

Comment thread post/views.py Outdated

### 얘네가 class inner function 들! ###
def get(self, request):
posts = Post.objects.annotate(like_count=Count('like_users')).order_by('-like_count')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모범 답안대로 잘 해줬습니다👏🏻

Comment thread comment/views.py
return Response({"detail": "Permission denied"}, status=status.HTTP_401_UNAUTHORIZED)

# request data로 CommentSerializer를 통해 Comment 객체 업데이트
serializer = CommentSerializer(comment, data=request.data, partial=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partial option 써준 거 아주 좋습니다~!~!

Comment thread comment/views.py

class CommentListView(APIView):
def get(self, request):
# 쿼리 파라미터에서 post_id 가져오기

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

주석 덕분에 코드리뷰하기 아주 편하군요😊

Comment thread comment/views.py
# Post 객체를 찾을 수 없으면, 404 Not Found 반환
# DoesNotExist는 Django에서 사용하는 예외입니다.
# 이 예외는 get() 쿼리 메소드를 사용하여 특정 모델 객체를 조회하려고 할 때, 일치하는 객체를 찾을 수 없는 경우 발생합니다.
except Post.DoesNotExist:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

꼼꼼한 예외처리도 훌륭합니다👍🏻

Comment thread comment/views.py
Comment on lines +95 to +96
if comment is None:
return Response({"detail": "Not found."}, status=status.HTTP_404_NOT_FOUND)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 이 부분은 무엇을 위해서 작성한 코드인지 알 수 있을까요???

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요 친구는 위에 코드를 적고 나서 지웠어야 하는데 지워지지 않은 친구네요..! 꼼꼼히 봐주셔서 감사합니다~ :-)

@rannie-kim rannie-kim left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정성스레 써주신 리뷰 모두 확인하였습니다~!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants