properly link to and control access to team detail page
This commit is contained in:
parent
40f4d1bb8d
commit
3998fe3369
3 changed files with 6 additions and 5 deletions
|
@ -2,5 +2,5 @@ from django.conf.urls.defaults import *
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns("symposion.teams.views",
|
urlpatterns = patterns("symposion.teams.views",
|
||||||
url(r"^(\w+)/$", "team_detail", name="team_detail"),
|
url(r"^([\w\-]+)/$", "team_detail", name="team_detail"),
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,7 +9,7 @@ from symposion.teams.models import Team
|
||||||
@login_required
|
@login_required
|
||||||
def team_detail(request, slug):
|
def team_detail(request, slug):
|
||||||
team = get_object_or_404(Team, slug=slug)
|
team = get_object_or_404(Team, slug=slug)
|
||||||
if team.get_state_for_user(request.user) != "manager":
|
if team.access == "invitation" and team.get_state_for_user(request.user) is None:
|
||||||
raise Http404()
|
raise Http404()
|
||||||
|
|
||||||
return render(request, "teams/team_detail.html", {
|
return render(request, "teams/team_detail.html", {
|
||||||
|
|
|
@ -148,11 +148,12 @@
|
||||||
{% available_teams as available_teams %}
|
{% available_teams as available_teams %}
|
||||||
{% if available_teams %}
|
{% if available_teams %}
|
||||||
<h4>Available Teams</h4>
|
<h4>Available Teams</h4>
|
||||||
<ul>
|
<dl>
|
||||||
{% for team in available_teams %}
|
{% for team in available_teams %}
|
||||||
<li>{{ team }} <span class="label">{{ team.get_access_display }}</span></li>
|
<dt><a href="{% url team_detail team.slug %}">{{ team }}</a> <span class="label">{{ team.get_access_display }}</span></dt>
|
||||||
|
{% if team.description %}<dd>{{ team.description }}</dd>{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</dl>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue