def get_queryset(self): "Build queryset for API using filters" net_types = self.request.query_params.getlist("net_type", None) if "all" in net_types: net_types = None search = self.request.query_params.get("search", None) if search is not None and search: net_types = None ip = self.request.query_params.get("ip", None) if ip is not None and ip: net_types = None organization = self.request.query_params.get("organization", None) vlan_number = self.request.query_params.get("vlan", None) description = self.request.query_params.get("description", None) within = self.request.query_params.get("within", None) usage = self.request.query_params.get("usage", None) # Build queryset queryset = PrefixQuerysetBuilder() queryset.within(within) queryset.net_type(net_types) queryset.search(search) queryset.organization(organization) queryset.vlan_number(vlan_number) queryset.contains_ip(ip) queryset.usage(usage) queryset.description(description) queryset.filter_full_prefixes() return queryset.finalize()
def get_queryset(self): # Extract filters organization = self.request.query_params.get("organization", None) # Build queryset queryset = PrefixQuerysetBuilder() queryset.organization(organization) queryset.net_type(["scope", "reserved"]) return queryset.finalize()
def get_queryset(self): # Extract filters prefix = self.request.QUERY_PARAMS.get("prefix", None) organization = self.request.QUERY_PARAMS.get("organization", None) # Build queryset queryset = PrefixQuerysetBuilder() queryset.organization(organization) queryset.net_type(["scope", "reserved"]) return queryset.finalize()