Example #1
0
def collaborative_comments(context, content):
    comments = get_comments_for_object(content)
    return {
        'num_comments': comments.count(),
        'ct': ContentType.objects.get_for_model(content),
        'content': content,
    }
Example #2
0
def ajax_num_comments(request, content_type_id, content_id):
    ct = get_object_or_404(ContentType, id=content_type_id)
    try:
        content = ct.get_object_for_this_type(id=content_id)
    except models.ObjectDoesNotExist:
        raise Http404('No %s matches the given query.' % ct.model_class()._meta.object_name)

    comments = get_comments_for_object(content)
    json_dict = simplejson.dumps({'num': comments.count()})
    return HttpResponse(json_dict, mimetype='application/javascript')
Example #3
0
def ajax_num_comments(request, content_type_id, content_id):
    ct = get_object_or_404(ContentType, id=content_type_id)
    try:
        content = ct.get_object_for_this_type(id=content_id)
    except models.ObjectDoesNotExist:
        raise Http404('No %s matches the given query.' %
                      ct.model_class()._meta.object_name)

    comments = get_comments_for_object(content)
    json_dict = simplejson.dumps({'num': comments.count()})
    return HttpResponse(json_dict, mimetype='application/javascript')
Example #4
0
def ajax_list_comments(request, content_type_id, content_id):
    ct = get_object_or_404(ContentType, id=content_type_id)
    try:
        content = ct.get_object_for_this_type(id=content_id)
    except models.ObjectDoesNotExist:
        raise Http404('No %s matches the given query.' % ct.model_class()._meta.object_name)

    comments = get_comments_for_object(content)
    is_revisor = request.user.has_perm('can_revise')
    return render_to_response('collab/collaborative_comments_list.html',
                              {'content': content,
                               'comments': comments,
                               'ct': ct,
                               'is_revisor': is_revisor,
                              },
                              context_instance=RequestContext(request))
Example #5
0
def ajax_list_comments(request, content_type_id, content_id):
    ct = get_object_or_404(ContentType, id=content_type_id)
    try:
        content = ct.get_object_for_this_type(id=content_id)
    except models.ObjectDoesNotExist:
        raise Http404('No %s matches the given query.' %
                      ct.model_class()._meta.object_name)

    comments = get_comments_for_object(content)
    is_revisor = request.user.has_perm('can_revise')
    return render_to_response('collab/collaborative_comments_list.html', {
        'content': content,
        'comments': comments,
        'ct': ct,
        'is_revisor': is_revisor,
    },
                              context_instance=RequestContext(request))
Example #6
0
def collaborative_comments(context, content):
    comments = get_comments_for_object(content)
    return {'num_comments': comments.count(),
            'ct': ContentType.objects.get_for_model(content),
            'content': content,
            }