Changeset - 40f4d1bb8d07
[Not reviewed]
0 2 0
James Tauber - 12 years ago 2012-08-02 01:49:54
jtauber@jtauber.com
display available teams on dashboard and remove debugging print
2 files changed with 8 insertions and 4 deletions:
0 comments (0 inline, 0 general)
symposion/teams/templatetags/teams_tags.py
Show inline comments
...
 
@@ -13,25 +13,24 @@ class AvailableTeamsNode(template.Node):
 
        if len(bits) == 3 and bits[1] == "as":
 
            return cls(bits[2])
 
        else:
 
            raise template.TemplateSyntaxError("%r takes 'as var'" % bits[0])
 
    
 
    def __init__(self, context_var):
 
        self.context_var = context_var
 
    
 
    def render(self, context):
 
        request = context["request"]
 
        teams = []
 
        for team in Team.objects.all():
 
            print team
 
            state = team.get_state_for_user(request.user)
 
            if team.access == "open":
 
                if state in [None, "invited"]:
 
                    teams.append(team)
 
            elif team.access == "application":
 
                if state in [None, "invited", "applied"]:
 
                    teams.append(team)
 
            elif team.access == "invitation":
 
                if state == "invited":
 
                    teams.append(team)
 
        context[self.context_var] = teams
 
        return u""
symposion_project/templates/dashboard.html
Show inline comments
...
 
@@ -137,18 +137,23 @@
 
                        <li>
 
                            {% if membership.state == "manager" %}
 
                                <a href="{% url team_detail membership.team.slug %}">{{ membership.team.name }}</a>
 
                            {% else %}
 
                                {{ membership.team.name }}
 
                            {% endif %}
 
                            <span class="badge">{{ membership.get_state_display }}</span>
 
                        </li>
 
                    {% endfor %}
 
                </ul>
 
            {% endif %}
 
            {% available_teams as available_teams %}
 
            {% for team in available_team %}
 
                {{ team }}
 
            {% endfor %}
 
            {% if available_teams %}
 
                <h4>Available Teams</h4>
 
                <ul>
 
                    {% for team in available_teams %}
 
                        <li>{{ team }} <span class="label">{{ team.get_access_display }}</span></li>
 
                    {% endfor %}
 
                </ul>
 
            {% endif %}
 
        </div>
 
    </div>
 
{% endblock %}
0 comments (0 inline, 0 general)