diff --git a/rowers/models.py b/rowers/models.py
index b02e4889..a846a2aa 100644
--- a/rowers/models.py
+++ b/rowers/models.py
@@ -634,6 +634,12 @@ class PaidPlan(models.Model):
class CoachingGroup(models.Model):
name = models.CharField(default='group',max_length=30,null=True,blank=True)
+
+ def __unicode__(self):
+ return 'Coaching Group {id}: {name}'.format(
+ id = self.pk,
+ name = self.name
+ )
# Extension of User with rowing specific data
class Rower(models.Model):
diff --git a/rowers/teams.py b/rowers/teams.py
index ad9ed73e..25500897 100644
--- a/rowers/teams.py
+++ b/rowers/teams.py
@@ -178,7 +178,7 @@ def coach_remove_athlete(coach,rower):
coach.mycoachgroup = coachgroup
coach.save()
- rower.coachingrgroups.remove(coachgroup)
+ rower.coachinggroups.remove(coachgroup)
return (1,'Coach removed')
diff --git a/rowers/templates/coacheerequestemail.html b/rowers/templates/coacheerequestemail.html
index fd0fbaa5..27f0bea4 100644
--- a/rowers/templates/coacheerequestemail.html
+++ b/rowers/templates/coacheerequestemail.html
@@ -4,7 +4,7 @@
Dear {{ name }},
- {{ coachname }} is inviting you to become your coach on rowsandall.com.
+ {{ coachname }} is offering to become your coach on rowsandall.com.
By accepting the invite, {{ coachname }} will have access to your
@@ -22,8 +22,8 @@
You can also click the direct link:
-
- {{ siteurl }}/rowers/me/coacheeinvitation/{{ code }}
+
+ {{ siteurl }}/rowers/me/coachoffer/{{ code }}/accept
diff --git a/rowers/templates/coachrequestemail.html b/rowers/templates/coachrequestemail.html
index 4523aa66..89e557c6 100644
--- a/rowers/templates/coachrequestemail.html
+++ b/rowers/templates/coachrequestemail.html
@@ -23,8 +23,8 @@
You can also click the direct link:
-
- {{ siteurl }}/rowers/me/coachinvitation/{{ code }}
+
+ {{ siteurl }}/rowers/me/coachrequest/{{ code }}/accept/
diff --git a/rowers/templates/dropathleteconfirm.html b/rowers/templates/dropathleteconfirm.html
new file mode 100644
index 00000000..73077b69
--- /dev/null
+++ b/rowers/templates/dropathleteconfirm.html
@@ -0,0 +1,33 @@
+{% extends "newbase.html" %}
+{% load staticfiles %}
+{% load rowerfilters %}
+
+{% block title %}Remove Athlete {% endblock %}
+
+{% block main %}
+
Confirm removing {{ athlete.user.first_name }} {{ athlete.user.last_name }}
+
+
+ -
+
This will remove this rower from your list of athlete. The athlete can still
+ be in one of your training groups, but you cannot upload workouts, run analysis
+ or edit settings on their behalf.
+
+
+
+
+ Cancel
+
+
+
+ Drop Athlete
+
+
+
+
+
+{% endblock %}
+
+{% block sidebar %}
+{% include 'menu_teams.html' %}
+{% endblock %}
diff --git a/rowers/templates/dropcoachconfirm.html b/rowers/templates/dropcoachconfirm.html
new file mode 100644
index 00000000..863c0e2c
--- /dev/null
+++ b/rowers/templates/dropcoachconfirm.html
@@ -0,0 +1,35 @@
+{% extends "newbase.html" %}
+{% load staticfiles %}
+{% load rowerfilters %}
+
+{% block title %}Remove Coach {% endblock %}
+
+{% block main %}
+Confirm removing {{ coach.user.first_name }} {{ coach.user.last_name }}
+
+
+ -
+
This will remove this coach from your list of coaches.
+ You can still be in this coach's training groups, but she/he is losing the ability to
+ upload workouts for you, run analysis
+ or edit your settings on your behalf.
+
+
+
+
+ Cancel
+
+
+
+ Drop Coach
+
+
+
+
+
+
+{% endblock %}
+
+{% block sidebar %}
+{% include 'menu_teams.html' %}
+{% endblock %}
diff --git a/rowers/templates/teams.html b/rowers/templates/teams.html
index 59570f7d..dfa4c8fa 100644
--- a/rowers/templates/teams.html
+++ b/rowers/templates/teams.html
@@ -5,7 +5,7 @@
{% block main %}
{% if teams %}
- -
+
-
My Groups
@@ -31,7 +31,7 @@
{% endif %}
{% if otherteams %}
- -
+
-
Open Groups
@@ -56,7 +56,7 @@
{% endif %}
- -
+
-
Groups I manage
{% if myteams %}
@@ -83,7 +83,7 @@
New Training Group
{% if coaches %}
- -
+
-
My Coaches
@@ -99,7 +99,7 @@
|
Remove
+ href="/rowers/coaches/{{ coach.id }}/dropcoachconfirm/">Remove
|
@@ -109,7 +109,7 @@
{% endif %}
{% if coachees %}
- -
+
-
My Rowers
@@ -125,7 +125,7 @@
|
Remove
+ href="/rowers/coaches/{{ coachee.id }}/dropconfirm/">Remove
|
@@ -297,7 +297,7 @@
{% endif %}
{% if potentialathletes %}
- -
+
-
Rowers you could coach
@@ -322,7 +322,7 @@
{% endif %}
{% if potentialcoaches %}
- -
+
-
Coaches who could coach you
diff --git a/rowers/tests/testdata/testdata.csv.gz b/rowers/tests/testdata/testdata.csv.gz
index 39549454..849a95e6 100644
Binary files a/rowers/tests/testdata/testdata.csv.gz and b/rowers/tests/testdata/testdata.csv.gz differ
diff --git a/rowers/urls.py b/rowers/urls.py
index c36f4a5b..71595bbe 100644
--- a/rowers/urls.py
+++ b/rowers/urls.py
@@ -412,6 +412,14 @@ urlpatterns = [
url(r'^team/(?P\d+)/requestmembership/(?P\d+)/$',views.team_requestmembership_view,name='team_requestmembership_view'),
url(r'^me/coachrequest/(?P\d+)/reject/$',views.reject_revoke_coach_request,
name='reject_revoke_coach_request'),
+ url(r'^coaches/(?P\d+)/dropconfirm/$',views.coach_drop_athlete_confirm_view,
+ name='coach_drop_athlete_confirm_view'),
+ url(r'^coaches/(?P\d+)/drop/$',views.coach_drop_athlete_view,
+ name='coach_drop_athlete_view'),
+ url(r'^coaches/(?P\d+)/dropcoachconfirm/$',views.athlete_drop_coach_confirm_view,
+ name='athlete_drop_coach_confirm_view'),
+ url(r'^coaches/(?P\d+)/dropcoach/$',views.athlete_drop_coach_view,
+ name='athlete_drop_coach_view'),
url(r'^me/coachrequest/(?P\d+)/revoke/$',views.reject_revoke_coach_request,
name='reject_revoke_coach_request'),
url(r'^me/coachoffer/(?P\d+)/reject/$',views.reject_revoke_coach_offer,
diff --git a/rowers/views/teamviews.py b/rowers/views/teamviews.py
index 27427c69..1546a777 100644
--- a/rowers/views/teamviews.py
+++ b/rowers/views/teamviews.py
@@ -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):
diff --git a/templates/newbasefront.html b/templates/newbasefront.html
index a131aeb8..791d6dd7 100644
--- a/templates/newbasefront.html
+++ b/templates/newbasefront.html
@@ -227,7 +227,7 @@
-
- Teams
+ Groups