all the plumbing to let people select, drop, offer, coaching
This commit is contained in:
@@ -279,6 +279,101 @@ def manager_requests_view(request,code=None,message='',successmessage=''):
|
||||
})
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
@login_required()
|
||||
def athlete_drop_coach_confirm_view(request,id):
|
||||
r = getrower(request.user)
|
||||
try:
|
||||
coach = Rower.objects.get(id=id)
|
||||
except Rower.DoesNotExist:
|
||||
raise Http404("This rower doesn't exist")
|
||||
if coach not in teams.rower_get_coaches(r):
|
||||
raise PermissionDenied("You are not allowed to do this")
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url':reverse('rower_teams_view'),
|
||||
'name': 'Teams'
|
||||
},
|
||||
{
|
||||
'url':reverse('athlete_drop_coach_confirm_view',kwargs={'id':id}),
|
||||
'name': 'Confirm drop athlete'
|
||||
}
|
||||
]
|
||||
|
||||
return render(request,'dropcoachconfirm.html',
|
||||
{
|
||||
'rower':r,
|
||||
'coach':coach
|
||||
})
|
||||
|
||||
@login_required()
|
||||
def coach_drop_athlete_confirm_view(request,id):
|
||||
r = getrower(request.user)
|
||||
try:
|
||||
rower = Rower.objects.get(id=id)
|
||||
except Rower.DoesNotExist:
|
||||
raise Http404("This rower doesn't exist")
|
||||
if rower not in teams.coach_getcoachees(r):
|
||||
raise PermissionDenied("You are not allowed to do this")
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url':reverse('rower_teams_view'),
|
||||
'name': 'Teams'
|
||||
},
|
||||
{
|
||||
'url':reverse('coach_drop_athlete_confirm_view',kwargs={'id':id}),
|
||||
'name': 'Confirm drop athlete'
|
||||
}
|
||||
]
|
||||
|
||||
return render(request,'dropathleteconfirm.html',
|
||||
{
|
||||
'rower':r,
|
||||
'athlete':rower
|
||||
})
|
||||
|
||||
@login_required()
|
||||
def coach_drop_athlete_view(request,id):
|
||||
r = getrower(request.user)
|
||||
try:
|
||||
rower = Rower.objects.get(id=id)
|
||||
except Rower.DoesNotExist:
|
||||
raise Http404("This rower doesn't exist")
|
||||
if rower not in teams.coach_getcoachees(r):
|
||||
raise PermissionDenied("You are not allowed to do this")
|
||||
|
||||
res,text = teams.coach_remove_athlete(r,rower)
|
||||
|
||||
if res:
|
||||
messages.info(request,'You are not coaching this athlete any more')
|
||||
else:
|
||||
messages.error(request,'There was an error dropping the athlete from your list')
|
||||
|
||||
url = reverse('rower_teams_view')
|
||||
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
@login_required()
|
||||
def athlete_drop_coach_view(request,id):
|
||||
r = getrower(request.user)
|
||||
try:
|
||||
coach = Rower.objects.get(id=id)
|
||||
except Rower.DoesNotExist:
|
||||
raise Http404("This coach doesn't exist")
|
||||
if coach not in teams.rower_get_coaches(r):
|
||||
raise PermissionDenied("You are not allowed to do this")
|
||||
|
||||
res,text = teams.coach_remove_athlete(coach,r)
|
||||
|
||||
if res:
|
||||
messages.info(request,'Removal successful')
|
||||
else:
|
||||
messages.error(request,'There was an error dropping the coach from your list')
|
||||
|
||||
url = reverse('rower_teams_view')
|
||||
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
@login_required()
|
||||
def team_requestmembership_view(request,teamid,userid):
|
||||
|
||||
Reference in New Issue
Block a user