Skip to content

Commit

Permalink
comment_list
Browse files Browse the repository at this point in the history
  • Loading branch information
yoonju977 committed Sep 8, 2024
1 parent 873b547 commit 1ff83e8
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 133 deletions.
2 changes: 1 addition & 1 deletion api/articles/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Meta:
"updated_at",
"thumbnail_image",
]
ordering = ["created_at"]


def get_user(self, obj):
user = obj.user
Expand Down
3 changes: 3 additions & 0 deletions api/comments/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class Meta:
"created_at",
"updated_at",
]


def get_user_profile_image(self, obj):
profile = obj.user.profile
Expand Down Expand Up @@ -169,6 +170,7 @@ class Meta:
"created_at",
"updated_at",
]


def get_user_profile_image(self, obj):
profile = obj.user.profile
Expand Down Expand Up @@ -227,6 +229,7 @@ class Meta:
"created_at",
"updated_at",
]



# 특정 댓글 조회 시리얼라이저
Expand Down
6 changes: 1 addition & 5 deletions api/comments/views/comment_crud_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from rest_framework.exceptions import PermissionDenied
from rest_framework.parsers import FormParser, MultiPartParser


from ..models import Comment, CommentImage
from ..s3instance import S3Instance
from ..serializers import (
Expand Down Expand Up @@ -86,7 +85,7 @@ class CommentListView(generics.ListAPIView):

def get_queryset(self):
article_id = self.kwargs["article_id"]
return Comment.objects.filter(article_id=article_id)
return Comment.objects.filter(article_id=article_id).order_by("created_at")


# 댓글 상세 조회 뷰
Expand All @@ -101,6 +100,3 @@ def get_queryset(self):
def get_object(self):
comment = super().get_object()
return comment



2 changes: 2 additions & 0 deletions api/users/views/user_auth_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def create(self, request, *args, **kwargs):
[user.email],
)

# jwt_tokens = GeneralAuthClass.set_auth_tokens_for_user(user)

response = Response(
{
"username": user.username,
Expand Down
Loading

0 comments on commit 1ff83e8

Please sign in to comment.