added helper method to determine team membership state for a user
This commit is contained in:
parent
283ac696ef
commit
a907b78bd1
3 changed files with 8 additions and 1 deletions
|
@ -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"),
|
||||
|
|
|
@ -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 %}
|
||||
|
|
|
@ -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")),
|
||||
|
|
Loading…
Reference in a new issue