add indication of club size to manager
This commit is contained in:
@@ -159,7 +159,7 @@ def create_request(team,user):
|
|||||||
if r2 in Rower.objects.filter(team=team):
|
if r2 in Rower.objects.filter(team=team):
|
||||||
return (0,'Already a member of that team')
|
return (0,'Already a member of that team')
|
||||||
|
|
||||||
if count_club_members(team.manager)+count_invites(team.manager) < r.clubsize:
|
if count_club_members(team.manager)+count_invites(team.manager) <= r.clubsize:
|
||||||
codes = [i.code for i in TeamRequest.objects.all()]
|
codes = [i.code for i in TeamRequest.objects.all()]
|
||||||
code = uuid.uuid4().hex[:10].upper()
|
code = uuid.uuid4().hex[:10].upper()
|
||||||
# prevent duplicates
|
# prevent duplicates
|
||||||
@@ -200,7 +200,7 @@ def create_invite(team,manager,user=None,email=''):
|
|||||||
except Rower.MultipleObjectsReturned:
|
except Rower.MultipleObjectsReturned:
|
||||||
return (0,'There is more than one user with that email address')
|
return (0,'There is more than one user with that email address')
|
||||||
|
|
||||||
if count_club_members(team.manager)+count_invites(team.manager) < r.clubsize:
|
if count_club_members(team.manager)+count_invites(team.manager) <= r.clubsize:
|
||||||
codes = [i.code for i in TeamInvite.objects.all()]
|
codes = [i.code for i in TeamInvite.objects.all()]
|
||||||
code = uuid.uuid4().hex[:10].upper()
|
code = uuid.uuid4().hex[:10].upper()
|
||||||
# prevent duplicates
|
# prevent duplicates
|
||||||
|
|||||||
@@ -149,6 +149,7 @@
|
|||||||
Teams
|
Teams
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-content">
|
<div class="dropdown-content">
|
||||||
|
<a class="button gray small" href="/rowers/me/teams/">Manage Teams</a>
|
||||||
{% for t in teams %}
|
{% for t in teams %}
|
||||||
<a class="button gray small" href="/rowers/list-workouts/team/{{ t.id }}/">{{ t.name }}</a>
|
<a class="button gray small" href="/rowers/list-workouts/team/{{ t.id }}/">{{ t.name }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -36,10 +36,76 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="grid_6 omega">
|
||||||
|
{% if otherteams %}
|
||||||
|
<h2>Other Teams</h2>
|
||||||
|
<table width="70%" class="listtable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Manager</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for team in otherteams %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="/rowers/team/{{ team.id }}/">{{ team.name }}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ team.manager.first_name }} {{ team.manager.last_name }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<p> </p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid_12 alpha">
|
||||||
|
<div class="grid_6 alpha">
|
||||||
|
{% if user.rower.rowerplan == 'coach' %}
|
||||||
|
<h2>Teams I manage</h2>
|
||||||
|
<p>Number of members: {{ clubsize }}</p>
|
||||||
|
<p>Maximum club size: {{ max_clubsize }}</p>
|
||||||
|
{% if myteams %}
|
||||||
|
<table width="70%" class="listtable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Manager</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for team in myteams %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="/rowers/team/{{ team.id }}/">{{ team.name }}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="grid_1">
|
||||||
|
<a class="button small red" href="/rowers/team/{{ team.id }}/deleteconfirm">Delete</a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
|
<div class="grid_2 suffix_4 alpha">
|
||||||
|
<a class="button green" href="/rowers/team/create">New Team</a>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<p> </p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_6 omega">
|
<div class="grid_6 omega">
|
||||||
{% if invites or requests or myrequests or myinvites %}
|
{% if invites or requests or myrequests or myinvites %}
|
||||||
<p>
|
|
||||||
<h2>Invitations and Requests</h2>
|
<h2>Invitations and Requests</h2>
|
||||||
<table width="90%" class="listtable">
|
<table width="90%" class="listtable">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -126,70 +192,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid_12 alpha">
|
|
||||||
<div class="grid_6 alpha">
|
|
||||||
{% if user.rower.rowerplan == 'coach' %}
|
|
||||||
<h2>Teams I manage</h2>
|
|
||||||
{% if myteams %}
|
|
||||||
<table width="70%" class="listtable">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Manager</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for team in myteams %}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="/rowers/team/{{ team.id }}/">{{ team.name }}</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="grid_1">
|
|
||||||
<a class="button small red" href="/rowers/team/{{ team.id }}/deleteconfirm">Delete</a>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{% endif %}
|
|
||||||
<div class="grid_2 suffix_4 alpha">
|
|
||||||
<a class="button green" href="/rowers/team/create">New Team</a>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<p> </p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="grid_6 omega">
|
|
||||||
{% if otherteams %}
|
|
||||||
<h2>Other Teams</h2>
|
|
||||||
<table width="70%" class="listtable">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Manager</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for team in otherteams %}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="/rowers/team/{{ team.id }}/">{{ team.name }}</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ team.manager.first_name }} {{ team.manager.last_name }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
<p> </p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -6416,11 +6416,14 @@ def rower_teams_view(request,message='',successmessage=''):
|
|||||||
requests = TeamRequest.objects.filter(user=request.user)
|
requests = TeamRequest.objects.filter(user=request.user)
|
||||||
myrequests = TeamRequest.objects.filter(team__in=myteams)
|
myrequests = TeamRequest.objects.filter(team__in=myteams)
|
||||||
myinvites = TeamInvite.objects.filter(team__in=myteams)
|
myinvites = TeamInvite.objects.filter(team__in=myteams)
|
||||||
|
clubsize = teams.count_invites(request.user)+teams.count_club_members(request.user)
|
||||||
|
max_clubsize = r.clubsize
|
||||||
|
|
||||||
return render(request, 'teams.html',
|
return render(request, 'teams.html',
|
||||||
{
|
{
|
||||||
'teams':ts,
|
'teams':ts,
|
||||||
'teams':get_my_teams(request.user),
|
'clubsize':clubsize,
|
||||||
|
'max_clubsize':max_clubsize,
|
||||||
'myteams':myteams,
|
'myteams':myteams,
|
||||||
'invites':invites,
|
'invites':invites,
|
||||||
'otherteams':otherteams,
|
'otherteams':otherteams,
|
||||||
|
|||||||
Reference in New Issue
Block a user