django-parler-rest
django-parler-rest copied to clipboard
"translations": [ "Input is not a valid dict" ]
Django=3.2.6
django-parler=2.2
django-parler-rest=2.1
djangorestframework=3.12.4
Issue trying to add value on translation field from api but not working. The TranslatedFields is not appearing on admin and the field in drf is passing as Input is not a valid dict.
i don't know
I hack it by adding value on translation field from api as string instead, then json.loads it back by overriding method to_internal_value of class TranslatedFieldsField as show below,
class CustomTranslatedFieldsField(TranslatedFieldsField):
def to_internal_value(self, data):
try:
data = json.loads(data)
except:
self.fail('invalid')
return super().to_internal_value(data)