view and url from team detail page

This commit is contained in:
James Tauber 2012-07-28 18:30:00 -04:00
parent a907b78bd1
commit 86a346f628
2 changed files with 22 additions and 0 deletions

6
symposion/teams/urls.py Normal file
View file

@ -0,0 +1,6 @@
from django.conf.urls.defaults import *
urlpatterns = patterns("symposion.teams.views",
url(r"^(\w+)/$", "team_detail", name="team_detail"),
)

16
symposion/teams/views.py Normal file
View file

@ -0,0 +1,16 @@
from django.http import Http404
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
from symposion.teams.models import Team
@login_required
def team_detail(request, slug):
team = get_object_or_404(Team, slug=slug)
if team.get_state_for_user(request.user) != "manager":
raise Http404()
return render(request, "teams/team_detail.html", {
})