Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"translations": [ "Input is not a valid dict" ] #35

Open
EliasOPrado2 opened this issue Aug 26, 2021 · 2 comments
Open

"translations": [ "Input is not a valid dict" ] #35

EliasOPrado2 opened this issue Aug 26, 2021 · 2 comments

Comments

@EliasOPrado2
Copy link

EliasOPrado2 commented Aug 26, 2021

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.

@7Davronbek
Copy link

i don't know

@silivanxay
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants