def json_data(request, content_type_id, object_id):
    if not simplejson:
        raise Http404
        
    ctype = get_object_or_404(ContentType, pk=content_type_id)
    try:
        obj = ctype.get_object_for_this_type(id=object_id)
    except:
        raise Http404
    
    positions = Position.objects.get_applicable(obj)
    
    data = [{"id":pos.pk,"name":pos.name,"value":pos.name} for pos in positions if request.GET.get('term', "") in pos.name]
    
    return HttpResponse(simplejson.dumps(data),
                                    mimetype='application/json')
This is used for the admin widget
dataset/ETHPy150Open callowayproject/django-kamasutra/positions/views.py/json_data