Skip to content

Commit

Permalink
Merge pull request daldal-Mango#34 from dddooo9/main
Browse files Browse the repository at this point in the history
그룹 페이지 function merge
  • Loading branch information
hyeoneedyou authored Aug 28, 2021
2 parents b759a04 + 8c13827 commit ce39b4e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27 deletions.
2 changes: 0 additions & 2 deletions groups/templates/groups/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ <h1>여기</h1>

<div class="goal_verify">
<a class="btn1" href="{% url 'groups:certify' goal.id %}">인증하기</a>
<a class="btn1" href="{% url 'groups:personal' goal.id %}">개인 도장판</a>
<a class="btn1" href="{% url 'groups:show_certify' goal.id %}">인증 열람</a>
</div>

<!-- The Modal -->
Expand Down
2 changes: 0 additions & 2 deletions groups/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
urlpatterns = [
path('<int:goal_id>', views.main, name="main"),
path('<int:goal_id>/certify/', views.certify, name="certify"),
path('<int:goal_id>/personal/', views.personal, name="personal"),
path('<int:goal_id>/show_certify/', views.show_certify, name="show_certify"),
path('group_list/', views.group_list, name="group_list"),
path('group_detail/', views.group_detail, name="group_detail"),
path('make_group/', views.make_group, name="make_group")
Expand Down
33 changes: 10 additions & 23 deletions groups/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,22 @@ def main(request, goal_id):
daily_name.append(name)
total_name.append(daily_name)

certifiy_list = goal.certifies.all()
status = get_status(goal)

context = {
'goal': goal,
'dates': board['dates'],
'member_count': member_count,
'level': level,
'name': total_name

'name': total_name,
'certifies': certifiy_list,
'achievements': board['achievements'],
'start_days': status['start_days'],
'success_days': status['success_days'],
'continuity_days': status['continuity_days'],
}

return render(request, 'groups/main.html', context)


Expand All @@ -66,21 +74,6 @@ def certify(request, goal_id):
return render(request, 'groups/certify.html', {'goal': goal})


def personal(request, goal_id):
goal = get_object_or_404(Goal, pk=goal_id)
status = get_status(goal)
board = get_board(goal)
context = {
'goal': goal,
'start_days': status['start_days'],
'success_days': status['success_days'],
'continuity_days': status['continuity_days'],
'dates': board['dates'],
'achievements': board['achievements'],
}
return render(request, 'groups/personal.html', context)


def get_status(goal): # 시작, 성공, 연속 일수를 리턴하는 함수
certifies = goal.certifies.all()
start_days = (datetime.date.today() - goal.start_date).days + 1
Expand Down Expand Up @@ -124,12 +117,6 @@ def get_board(goal): # 도장판의 날짜와 성공 여부를 리턴하는
return res


def show_certify(request, goal_id):
goal = Goal.objects.get(pk=goal_id)
certifies = goal.certifies.all()
return render(request, 'groups/show_certify.html', {'goal': goal, 'certifies': certifies})


def group_list(request):
return render(request, 'groups/group_list.html')

Expand Down

0 comments on commit ce39b4e

Please sign in to comment.