Ejemplo n.º 1
0
def index(request):
    """话题首页面"""
    topics = Topic.objects.all()
    nodes = Node.objects.all()

    return render_to_response('topics/index.html', {
        'topics': topics,
        'nodes': nodes,
        'user_count': user_count(),
        'comments_count': comments_count(),
        'top_comments': top_comments()
    },
                              context_instance=RequestContext(request))
Ejemplo n.º 2
0
def node_topics(request, node_pk):
    nodes = Node.objects.all()
    node = get_object_or_404(Node, pk=node_pk)
    topics = node.topic_set.all()

    return render_to_response(
        'topics/index.html',
        {
            'nodes': nodes,
            'topics': topics,  ## 此处bug
            'is_node': node,
            'user_count': user_count(),
            'comments_count': comments_count()
        },
        context_instance=RequestContext(request))