added helper method to determine team membership state for a user

This commit is contained in:
James Tauber 2012-07-28 18:29:19 -04:00
parent 283ac696ef
commit a907b78bd1
3 changed files with 8 additions and 1 deletions

View file

@ -26,6 +26,12 @@ class Team(models.Model):
def __unicode__(self):
return self.name
def get_state_for_user(self, user):
try:
return self.memberships.get(user=user).state
except Membership.DoesNotExist:
return None
MEMBERSHIP_STATE_CHOICES = [
("applied", "applied"),

View file

@ -135,7 +135,7 @@
{% for membership in user.memberships.all %}
<li>
{% if membership.state == "manager" %}
<a href="#">{{ membership.team.name }}</a>
<a href="{% url team_detail membership.team.slug %}">{{ membership.team.name }}</a>
{% else %}
{{ membership.team.name }}
{% endif %}

View file

@ -28,6 +28,7 @@ urlpatterns = patterns("",
url(r"^proposals/", include("symposion.proposals.urls")),
url(r"^sponsors/", include("symposion.sponsorship.urls")),
url(r"^boxes/", include("symposion.boxes.urls")),
url(r"^teams/", include("symposion.teams.urls")),
url(r"^markitup/", include("markitup.urls")),
url(r"^", include("symposion.cms.urls")),