fix browseable api exceptions in subscriber
diff --git a/xos/api/tenant/cord/subscriber.py b/xos/api/tenant/cord/subscriber.py
index 89f42b9..b33c7ad 100644
--- a/xos/api/tenant/cord/subscriber.py
+++ b/xos/api/tenant/cord/subscriber.py
@@ -129,6 +129,11 @@
queryset = CordSubscriberNew.get_tenant_objects().select_related().all()
serializer_class = CordSubscriberSerializer
+ custom_serializers = {"set_features": FeatureSerializer,
+ "set_feature": FeatureSerializer,
+ "set_identities": IdentitySerializer,
+ "set_identity": IdentitySerializer}
+
@classmethod
def get_urlpatterns(self, api_path="^"):
patterns = super(CordSubscriberViewSet, self).get_urlpatterns(api_path=api_path)
diff --git a/xos/api/tenant/onos/app.py b/xos/api/tenant/onos/app.py
index 7e42336..481057d 100644
--- a/xos/api/tenant/onos/app.py
+++ b/xos/api/tenant/onos/app.py
@@ -43,12 +43,6 @@
custom_serializers = {"set_attribute": TenantAttributeSerializer}
- def get_serializer_class(self):
- if self.action in self.custom_serializers:
- return self.custom_serializers[self.action]
- else:
- return super(ONOSAppViewSet, self).get_serializer_class()
-
@classmethod
def get_urlpatterns(self, api_path="^"):
patterns = super(ONOSAppViewSet, self).get_urlpatterns(api_path=api_path)
diff --git a/xos/api/xosapi_helpers.py b/xos/api/xosapi_helpers.py
index df405e5..6f5665c 100644
--- a/xos/api/xosapi_helpers.py
+++ b/xos/api/xosapi_helpers.py
@@ -98,6 +98,12 @@
return patterns
+ def get_serializer_class(self):
+ if hasattr(self, "custom_serializers") and hasattr(self, "action") and (self.action in self.custom_serializers):
+ return self.custom_serializers[self.action]
+ else:
+ return super(XOSViewSet, self).get_serializer_class()
+
class XOSIndexViewSet(viewsets.ViewSet):
view_urls=[]
subdirs=[]