Пример #1
0
def filter_user(queryset, queries):
    q = query("user", queries)
    ids = get_model_field("user", q, 'uuid')
    qor = Q(members__uuid__in=ids) | Q(owner__uuid__in=ids)
    # BIG FAT FIXME: The below two lines in theory should not be necessary, but
    # if they don't exist, the queryset will produce weird results with the
    # addition of values list.
    qs = queryset.select_related("owner__uuid").filter(qor)
    len(qs)
    return qs
Пример #2
0
def filter_network(queryset, queries):
    q = query("network", queries)
    ids = get_model_field("network", q, 'id')
    return queryset.filter(network_id__in=ids)
Пример #3
0
def filter_user(queryset, queries):
    q = query("user", queries)
    user_ids = get_model_field("user", q, 'uuid')
    vm_ids = VirtualMachine.objects.filter(userid__in=user_ids)
    return queryset.filter(server_id__in=vm_ids)
Пример #4
0
def filter_ip(queryset, queries):
    q = query("ip", queries)
    ids = get_model_field("ip", q, 'userid')
    return queryset.filter(uuid__in=ids)
Пример #5
0
def filter_project(queryset, queries):
    q = query("project", queries)
    ids = get_model_field("project", q, 'uuid')
    return queryset.filter(project__in=ids)
Пример #6
0
def filter_ip(queryset, queries):
    q = query("ip", queries)
    ids = get_model_field("ip", q, "machines__id")
    return queryset.filter(id__in=ids)
Пример #7
0
def filter_user(queryset, queries):
    q = query("user", queries)
    ids = get_model_field("user", q, "uuid")
    return queryset.filter(userid__in=ids)
Пример #8
0
def filter_ip(queryset, queries):
    q = query("ip", queries)
    return queryset.filter(q)
Пример #9
0
def filter_ip(queryset, queries):
    q = query("ip", queries)
    ids = get_model_field("ip", q, 'machines__id')
    return queryset.filter(id__in=ids)
Пример #10
0
def filter_volume(queryset, queries):
    q = query("volume", queries)
    ids = get_model_field("volume", q, 'machine__id')
    return queryset.filter(id__in=ids)
Пример #11
0
def filter_vm(queryset, queries):
    q = query("vm", queries)
    return queryset.filter(q)
Пример #12
0
def filter_network(queryset, queries):
    q = query("network", queries)
    ids = get_model_field("network", q, 'project')
    return queryset.filter(uuid__in=ids)
Пример #13
0
def filter_volume(queryset, queries):
    q = query("volume", queries)
    ids = get_model_field("volume", q, 'project')
    return queryset.filter(uuid__in=ids)
Пример #14
0
def filter_project(queryset, queries):
    q = query("project", queries)
    return queryset.filter(q)
Пример #15
0
def filter_ip(queryset, queries):
    q = query("ip", queries)
    ids = get_model_field("ip", q, 'nic__network__id')
    return queryset.filter(id__in=ids)
Пример #16
0
def filter_volume(queryset, queries):
    q = query("volume", queries)
    return queryset.filter(q)
Пример #17
0
def filter_network(queryset, queries):
    q = query("network", queries)
    ids = get_model_field("network", q, 'id')
    return queryset.filter(network_id__in=ids)
Пример #18
0
def filter_user(queryset, queries):
    q = query("user", queries)
    return queryset.filter(q)
Пример #19
0
def filter_vm(queryset, queries):
    q = query("vm", queries)
    return queryset.filter(q)
Пример #20
0
def filter_ip(queryset, queries):
    q = query("ip", queries)
    ids = get_model_field("ip", q, 'userid')
    return queryset.filter(uuid__in=ids)
Пример #21
0
def filter_volume(queryset, queries):
    q = query("volume", queries)
    ids = get_model_field("volume", q, "machine__id")
    return queryset.filter(id__in=ids)
Пример #22
0
def filter_project(queryset, queries):
    q = query("project", queries)
    member_ids = Project.objects.filter(q).values('members__uuid')
    owner_ids = Project.objects.filter(q).values('owner__uuid')
    qor = Q(uuid__in=member_ids) | Q(uuid__in=owner_ids)
    return queryset.filter(qor)
Пример #23
0
def filter_project(queryset, queries):
    q = query("project", queries)
    ids = get_model_field("project", q, "uuid")
    return queryset.filter(project__in=ids)
Пример #24
0
def filter_volume(queryset, queries):
    q = query("volume", queries)
    return queryset.filter(q)
Пример #25
0
def filter_user(queryset, queries):
    q = query("user", queries)
    return queryset.filter(q)
Пример #26
0
def filter_vm(queryset, queries):
    q = query("vm", queries)
    ids = get_model_field("vm", q, "id")
    return queryset.filter(nic__machine__id__in=ids)
Пример #27
0
def filter_project(queryset, queries):
    q = query("project", queries)
    member_ids = Project.objects.filter(q).values('members__uuid')
    owner_ids = Project.objects.filter(q).values('owner__uuid')
    qor = Q(uuid__in=member_ids) | Q(uuid__in=owner_ids)
    return queryset.filter(qor)
Пример #28
0
def filter_user(queryset, queries):
    q = query("user", queries)
    user_ids = get_model_field("user", q, 'uuid')
    vm_ids = VirtualMachine.objects.filter(userid__in=user_ids)
    return queryset.filter(server_id__in=vm_ids)
Пример #29
0
def filter_vm(queryset, queries):
    q = query("vm", queries)
    ids = get_model_field("vm", q, 'id')
    return queryset.filter(server_id__in=ids)
Пример #30
0
def filter_vm(queryset, queries):
    q = query("vm", queries)
    ids = get_model_field("vm", q, 'id')
    return queryset.filter(server_id__in=ids)
Пример #31
0
def filter_ip(queryset, queries):
    q = query("ip", queries)
    return queryset.filter(q)
Пример #32
0
def filter_network(queryset, queries):
    q = query("network", queries)
    return queryset.filter(q)