コード例 #1
0
def modelList(request, klass, subclass=False):
    kl = None
    if getattr(klass, 'deletable', False):
        kl = "deletable"

    for o in klass.objects.all():
        o = get_subclass(o) if subclass else o
        yield Node( URL(o), str(o), klass=kl ).getDict()
コード例 #2
0
def modelList(request, klass, subclass=False):
    kl = None
    if getattr(klass, 'deletable', False):
        kl = "deletable"

    for o in klass.objects.all():
        o = get_subclass(o) if subclass else o
        yield Node(URL(o), str(o), klass=kl).getDict()
コード例 #3
0
def relatedDetailSubQuery(request, app, model, rel_field, rel_pk, min_pk, max_pk):
    qs = mod.get_model(app, model).objects.all()
    req = {
        str("%s__pk" % rel_field): int(rel_pk),
        "pk__gte": int(min_pk),
        "pk__lt": int(max_pk),
    }
    qs = qs.filter(**req)

    return HttpResponse( 
        simplejson.dumps( [ ModelNode(get_subclass(o)).getDict() for o in qs] ), 
        content_type="application/json")
コード例 #4
0
def relatedDetailSubQuery(request, app, model, rel_field, rel_pk, min_pk,
                          max_pk):
    qs = mod.get_model(app, model).objects.all()
    req = {
        str("%s__pk" % rel_field): int(rel_pk),
        "pk__gte": int(min_pk),
        "pk__lt": int(max_pk),
    }
    qs = qs.filter(**req)

    return HttpResponse(simplejson.dumps(
        [ModelNode(get_subclass(o)).getDict() for o in qs]),
                        content_type="application/json")