예제 #1
0
    def to_python(self, value):
        if not value or isinstance(value, RasterRenderer):
            return value

        try:
            style_configurations = json.loads(value)
            return {int(k): get_renderer_from_definition(v) for k, v in six.iteritems(style_configurations)}
        except ValueError as e:
            raise ValidationError("Invalid renderer configuration: {}".format(e))
예제 #2
0
파일: api.py 프로젝트: consbio/ncdjango
    def hydrate_renderer(self, bundle):
        if bundle.data.get('renderer'):
            bundle.data['renderer'] = get_renderer_from_definition(bundle.data['renderer'])

        return bundle