(self, value)
| 1355 | super().__init__(**kwargs) |
| 1356 | |
| 1357 | def to_python(self, value): |
| 1358 | if self.disabled: |
| 1359 | return value |
| 1360 | if value in self.empty_values: |
| 1361 | return None |
| 1362 | elif isinstance(value, (list, dict, int, float, JSONString)): |
| 1363 | return value |
| 1364 | try: |
| 1365 | converted = json.loads(value, cls=self.decoder) |
| 1366 | except json.JSONDecodeError: |
| 1367 | raise ValidationError( |
| 1368 | self.error_messages["invalid"], |
| 1369 | code="invalid", |
| 1370 | params={"value": value}, |
| 1371 | ) |
| 1372 | if isinstance(converted, str): |
| 1373 | return JSONString(converted) |
| 1374 | else: |
| 1375 | return converted |
| 1376 | |
| 1377 | def bound_data(self, data, initial): |
| 1378 | if self.disabled: |
no test coverage detected