def to_representation(self, obj): ret = {} if obj is not None: # Make it work two different ways.. ooooh if isinstance(obj, models.Stack): ret = obj.properties else: ret = obj return recursively_sort_dict(ret)
def retrieve(self, request, *args, **kwargs): formula = self.get_object() # determine if a version was specified version = request.query_params.get('version') if version not in formula.get_valid_versions(): version = formula.default_version properties = formula.properties(version) return Response(recursively_sort_dict(properties))
def to_representation(self, obj): ret = {} if obj is not None: ret = obj.global_orchestration_properties return recursively_sort_dict(ret)
def to_representation(self, value): ret = super(PropertiesField, self).to_representation(value) return utils.recursively_sort_dict(ret)
def to_representation(self, instance): return utils.recursively_sort_dict(instance.properties)