Forums

this def has any error,hoow do i debug it?

@login_required(login_url=LOGIN_URL)
def users_list(request):
    group_id = request.GET.get('group_id')
    appitem = get_appitem(request.user)
    app_users = 123
    if group_id:
        group = appitem.app_groups.get(id=group_id)
        app_users = group.app_users.all()
    else:
        app_users = appitem.app_users.all()
    app_groups = appitem.app_groups.all()
    matchs, show_pages = page_turning(app_users, request, 10)

    context = {
        'appitem': appitem,
        'app_groups': app_groups,
        'app_users': app_users,
        'matchs': matchs,
        'show_pages': show_pages,
    }
    #print app_users
    return render_to_response('yimi_admin/users_list.html', context,
        context_instance=RequestContext(request))

users_list.html

{% extends "yimi_admin/base.html" %}
{% load tag_extras %}
{% block right_div %}
<link href="/static/watch/css/change.css" rel="stylesheet" type="text/css" />

<div id="content" class="span10">
    <div class="wrapper">
        <div class="widget">
            <div class="navbar">
                <div class="navbar-inner">
                    <h6>管理</h6>

                </div>
            </div>

            <div class="widget">

                <ul class="options-bar">
                    <li>
                        <div class="  align-left">
                            <div class="bar-button"><button type="button" class="btn" onclick="location.href='{% url 'yimi_admin:users_list' %}'" >全部用户</button></div>
                            {% for app_group in app_groups %}
                            <div class="bar-button"><button type="button" class="btn btn-success" onclick="location.href='{% url 'yimi_admin:users_list' %}?group_id={{app_group.id}}'">{{app_group.name}}</button></div>
                            {% endfor %}
                        </div>  
                    </li>
                </ul>

            </div>
            <!-- /options bar -->                            
            <div class="table-overflow">

<div class="digg"><div class="sh_page" style="float:right;margin-top:3px;margin-bottom:9px;margin-right:-10px;">
{% if matchs.has_previous%}
<span><a href="?p={{matchs.previous_page_number }}">&lt; </span>
{%else%}
<span class="disabled">&lt; </span>
{%endif%}
{% for p in show_pages %}
<span ><a {% if p == matchs.number %} style="border:none; background-color:#333333;color:white;border-radius:5px;padding:5px 10px;"{% endif %}  href="?p={{p}}">{{p}}</a></span>
{% endfor %}

{% if matchs.has_next  %}  
<span ><a href="?p={{ matchs.next_page_number }}">&gt; </a></span>
{% else %}
<span class="disabled">&gt; </span>
{% endif %}
</div>



                <table class="table table-striped table-bordered table-checks media-table">
                    <thead>
                        <tr>
                            <th><input type="checkbox" name="checkRow" class="styled all-select" style="width:16px"/></th>
                            <th>用户名</th>
                            <th>所在组</th>
                            <th class="actions-column">加入组</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for user in matchs %}
                        <tr>
                            <th><input type="checkbox" name="artwork_ids[]" class="styled" style="width:16px"  /></th>

                           <td>{{user.nickname}}</td>
                           <td>
{% for app_group in app_groups %}
{% if user in app_group.app_users.all %}
<li>{{app_group.name}} <a href="{% url 'yimi_admin:group_remove' %}?userid={{user.id}}&groupid={{app_group.id}}">移除</a></li>
{% endif %}
{% endfor %}
                           </td>
                           <td>
<select class="app-group-select" uservalue="{{user.id}}">
<option>选择分组</option>
{% for app_group in app_groups %}
{% if user not in app_group.app_users.all %}
<option value="{{app_group.id}}" >{{app_group.name}}</option>
{% endif %}
{% endfor %}
</select>
                           </td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<link rel="stylesheet" href="/static/myadmin/css/list.css" />

<script type="text/javascript">

$('#submit-group').click(
    function(){
        location.href="{% url 'yimi_admin:groups_add' %}?groupname="+$('#group-name-value').val();
})

$(".app-group-select").change(
    function(){
        location.href="{% url 'yimi_admin:group_update' %}?userid="+$(this).attr('uservalue')+'&groupid='+$(this).val();
    }   
)


</script>

{% endblock %}

why <td>{{user.nickname}}</td> always print None?

I don't see any way that user is passed into the template.