properly link to and control access to team detail page

This commit is contained in:
James Tauber 2012-08-01 21:59:23 -04:00
parent 40f4d1bb8d
commit 3998fe3369
3 changed files with 6 additions and 5 deletions

View file

@ -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"),
) )

View file

@ -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", {

View file

@ -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>