You must me getting the keys of your choices rather than your choice text ,
you can override the field  with serializer method field  and return your
text according to your choice key.

On Thu, 10 Jun 2021 at 09:57, Lalit Suthar <sutharlalit...@gmail.com> wrote:

> can I see that model field, I don't think any extra configuration is
> required for it
>
> On Thu, 10 Jun 2021 at 04:44, ezequia...@gmail.com <
> ezequias.ro...@gmail.com> wrote:
>
>> Hey guys
>>
>> Could you help me with a Django Rest Framework question?
>>
>> I have a field in my model that has possible input values, so I'm using
>> the *choices=* attribute in my model.
>>
>> I'm having difficulty serializing the return of this data in drf.
>>
>> Could someone give me a hint on how best to implement this, please?
>>
>> Sincerely
>> Hezekiah Rock
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/b6cd89ca-06be-4d5d-bdd0-ba9cbb952e72n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/b6cd89ca-06be-4d5d-bdd0-ba9cbb952e72n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGp2JVFT22C-6m4121LLQWpXZuzAy8Vtbqviy2TVVTJu3JJTKA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGp2JVFT22C-6m4121LLQWpXZuzAy8Vtbqviy2TVVTJu3JJTKA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFOOHnMS8%3DnEOnw9EHYiJw2H6%3DhnBm%3DPWHu3iRJxMNYXzbp4yg%40mail.gmail.com.

Reply via email to