Skip to content

Commit

Permalink
fix: real detail
Browse files Browse the repository at this point in the history
  • Loading branch information
KRimwoo committed Jul 7, 2023
1 parent 939de02 commit dd84d25
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
9 changes: 5 additions & 4 deletions relanz/community/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,20 @@ def detail(request, challenge_id, article_id):
like_count = len(Like.objects.filter(article=page_obj.object_list[0]))
author_nickname = page_obj.object_list[0].author.user.nickname
isExist = Like.objects.filter(likedUser=request.user, article=page_obj.object_list[0]).exists()

except PageNotAnInteger:
page = 1
page_obj = paginator.get_page(page)
page_number = 1
page_obj = paginator.get_page(page_number)
like_count = len(Like.objects.filter(article=article))
author_nickname = article.author.user.nickname
isExist = Like.objects.filter(likedUser=request.user, article=article).exists()

except EmptyPage:
page=paginator.num_pages
page_obj=paginator.page(page)
messages.add_message(request, messages.ERROR, '더 이상 인증 글이 없습니다.')

res_data = {'challenge':challenge, 'articles':page_obj, 'like_count':like_count, 'author_nickname':author_nickname, "isExist": isExist, "participant":participant, "current":article}
res_data = {'challenge':challenge, 'articles':page_obj, 'like_count':like_count, 'author_nickname':author_nickname, "isExist": isExist, "participant":participant, "current": article}
return render(request, 'community/detail.html', res_data)

@csrf_exempt
Expand Down
17 changes: 8 additions & 9 deletions relanz/static/css/detail.css
Original file line number Diff line number Diff line change
Expand Up @@ -354,17 +354,16 @@

top: 70px;
background-color: white;

overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
}
.main-image-div > img {
/* object-fit: cover; */
object-fit: contain;
max-width: 430px;
max-height: 430px;

/* object-fit: cover; */
object-fit: contain;
max-width: 430px;
max-height: 430px;
}

.rest-image-bundle-div {
Expand All @@ -373,7 +372,7 @@
height: 130px;
flex-shrink: 0;
margin-top: 25px;
background: #D0E0FF;
background: #d0e0ff;
width: 100%;
/* margin-top: 65px;
background: #d0e0ff;
Expand Down Expand Up @@ -530,6 +529,6 @@
}

.warning-btn:hover {
cursor: pointer;
background-color: rgba(63, 128, 252, 1);
cursor: pointer;
background-color: rgba(63, 128, 252, 1);
}
12 changes: 1 addition & 11 deletions relanz/templates/community/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,7 @@
</div>
</div>
<div class="detail-content-background">
{% if articles.has_next %}
<a href="?page={{ articles.next_page_number }}#focus" class="left">
<img src="{% static "icons/left_arrow.svg" %}" alt=".">
</a>
{% endif %}

{% if articles.has_previous %}
<a href="?page={{ articles.previous_page_number }}#focus" class="right">
<img src="{% static "icons/right_arrow.svg" %}" alt=".">
</a>
{% endif %}


<div class="main-content-div">
{% for article in articles %}
Expand Down

0 comments on commit dd84d25

Please sign in to comment.