コード例 #1
0
def test_from_model_with_queryset():
    t = Query.from_model(rows=Foo.objects.all()).bind(request=None)
    assert list(t.declared_variables.keys()) == ['id', 'foo']
    assert list(t.variables.keys()) == ['foo']
コード例 #2
0
def test_from_model_with_model_class():
    t = Query.from_model(model=Foo).bind(request=None)
    assert list(t.declared_variables.keys()) == ['id', 'foo']
    assert list(t.variables.keys()) == ['foo']