support REST query by service_specific_id and vlan_id
diff --git a/xos/core/xoslib/methods/volttenant.py b/xos/core/xoslib/methods/volttenant.py
index 356938e..a927c3f 100644
--- a/xos/core/xoslib/methods/volttenant.py
+++ b/xos/core/xoslib/methods/volttenant.py
@@ -38,17 +38,33 @@
return obj.__unicode__()
class VOLTTenantList(XOSListCreateAPIView):
- queryset = VOLTTenant.get_tenant_objects().select_related().all()
serializer_class = VOLTTenantIdSerializer
method_kind = "list"
method_name = "volttenant"
+ def get_queryset(self):
+ queryset = VOLTTenant.get_tenant_objects().select_related().all()
+
+ service_specific_id = self.request.QUERY_PARAMS.get('service_specific_id', None)
+ if service_specific_id is not None:
+ queryset = queryset.filter(service_specific_id=service_specific_id)
+
+ vlan_id = self.request.QUERY_PARAMS.get('vlan_id', None)
+ if vlan_id is not None:
+ ids = [x.id for x in queryset if x.get_attribute("vlan_id", None)==vlan_id]
+ queryset = queryset.filter(id__in=ids)
+
+ return queryset
+
class VOLTTenantDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = VOLTTenant.get_tenant_objects().select_related().all()
serializer_class = VOLTTenantIdSerializer
+ queryset = VOLTTenant.get_tenant_objects().select_related().all()
method_kind = "detail"
method_name = "volttenant"
+
+
+