Пример #1
0
def getProducts(request):
    #if request.is_ajax():
    if True:
        #Set the result to serialized JSON data.
        #result = serialize("json", data_obj)
        result = serialize("json", Product.objects.all())
    else:
        raise Http404
    
    return HttpResponse(result)
Пример #2
0
def data(request):
    """ Creates a page with data as defined by GET """
    search = request.GET
    start = int(search.get('start'))
    end = start + int(search.get('count'))

    job_list = Job.objects.order_by('-begin')[start:end]
  
    num_jobs = Job.objects.count()

    json_data = serialize(job_list)
    
    json_data = json_data.replace(u"\"numRows\": 20", u"\"numRows\": %i" % (num_jobs) )

    return HttpResponse(json_data, mimetype="application/json")
Пример #3
0
def data(request):
    """ Creates a page with data as defined by GET """
    search = request.GET
    start = int(search.get('start'))
    end = start + int(search.get('count'))

    job_list = Job.objects.order_by('-begin')[start:end]

    num_jobs = Job.objects.count()

    json_data = serialize(job_list)

    json_data = json_data.replace(u"\"numRows\": 20",
                                  u"\"numRows\": %i" % (num_jobs))

    return HttpResponse(json_data, mimetype="application/json")
Пример #4
0
def getEntities(request):
    #http://imi.chadrempp.com:8181/imictl/get/entities/
    #data = serializers.serialize("json", Product.objects.all())
    #data = serializers.serialize("json", Entity.objects.all())
    #return HttpResponse(.dumps(response_dict), mimetype='application/javascript')
    #data =  Entity.objects.all()
    #return HttpResponse(simplejson.dumps(data), mimetype='application/javascript')
    
    #if request.is_ajax():
    if True:
        #Set the result to serialized JSON data.
        #result = serialize("json", data_obj)
        result = serialize("json", Entity.objects.all())
    else:
        raise Http404
    
    return HttpResponse(result)