Skip to content

Commit

Permalink
Merge pull request daldal-Mango#38 from dddooo9/main
Browse files Browse the repository at this point in the history
매니저의 그룹멤버 강퇴식
  • Loading branch information
SJLEE316 authored Aug 28, 2021
2 parents 9677580 + 73ebe94 commit af5860b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions groups/templates/groups/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ <h2>{{dates|index_1:0}} ~ {{dates|index_1:29}}</h2>
</div>
</article>
<article id="tab3" class="content-container__content certify_container">
{{goal.manager}}
{% for member in goal.member.all %}
{% if request.user == goal.manager %}
<a href="{% url 'groups:delete_member' goal.id member.id %}">{{member}}</a>
{% else %}
{{member}}
{% endif %}
{% endfor %}
{% for certify in certifies %}
<ul class="certify_list">
<li>아이디<span>{{ certify.user }}</span></li>
Expand Down
2 changes: 2 additions & 0 deletions groups/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
path('group_detail/', views.group_detail, name="group_detail"),
path('make_group/', views.make_group, name="make_group"),
path('<int:goal_id>/date_check', views.date_check, name="date_check"),
path('<int:goal_id>/<int:user_id>/delete_member', views.delete_member, name="delete_member"),

]
10 changes: 9 additions & 1 deletion groups/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.shortcuts import render, get_object_or_404, redirect
from main.models import Goal
from .models import Certify
from .models import Certify, User
from datetime import datetime, timedelta
import datetime
from django.utils import timezone
Expand Down Expand Up @@ -135,3 +135,11 @@ def group_detail(request):

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


def delete_member(request, goal_id, user_id):
goal = Goal.objects.get(pk=goal_id)

delete_user = User.objects.get(pk=user_id)
delete_user.members.remove(goal)
return redirect('groups:main', goal_id)

0 comments on commit af5860b

Please sign in to comment.