support for editing subscriber features
diff --git a/xos/api/tenant/cord/subscriber.py b/xos/api/tenant/cord/subscriber.py
index 5884b82..7df8410 100644
--- a/xos/api/tenant/cord/subscriber.py
+++ b/xos/api/tenant/cord/subscriber.py
@@ -101,6 +101,8 @@
identity = IdentitySerializer(required=False)
related = serializers.DictField(required=False)
+ nested_fields = ["features", "identity"]
+
class Meta:
model = CordSubscriberNew
fields = ('humanReadableName',
@@ -116,6 +118,17 @@
obj = self.Meta.model(**validated_data)
return obj
+ def update(self, instance, validated_data):
+ for k in validated_data.keys():
+ v = validated_data[k]
+ if k in self.nested_fields:
+ d = getattr(instance,k)
+ d.update(v)
+ setattr(instance,k,d)
+ else:
+ setattr(instance, k, v)
+ return instance
+
# @ensure_csrf_cookie
class CordSubscriberViewSet(XOSViewSet):
base_name = "subscriber"