i'm sorry, please excuse my ignorance, what is the "
ACTION_MAPPING_SERIALIZER[self.action]  "?
could you give me a real example ?
I fondly anticipate your reply ,thank you .


Linh Hoàng Ngọc <[email protected]> 于2022年8月15日周一 13:47写道:

> In this view, we can switch serializers to the following the method.
> Refer:
> ```def get_serializer_class(self): # type: ignore
> return ACTION_MAPPING_SERIALIZER[self.action]
> ```
> Vào lúc 09:03:21 UTC+7 ngày Thứ Hai, 15 tháng 8, 2022, [email protected]
> đã viết:
>
>> hi , guys.
>> i created a article model that has three fields;  Id 、title 、content;
>> i created a article ModelSerializer class about  the article model。
>> but sometime i want to only serialize partly  fields(example:id、title ,
>> in the listview),
>> sometime i want to serialize all of the fields (example: id
>>  、title、content,  in the retrieve view)
>> if i only have a ModelSerializer class, what should i do ?
>>
>> please let me know.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-rest-framework/3bc2d80a-2803-4041-85aa-a372fdc155dan%40googlegroups.com
> <https://groups.google.com/d/msgid/django-rest-framework/3bc2d80a-2803-4041-85aa-a372fdc155dan%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/CAGVKvXcx1mO_rbtRKSV%2B1SAqV-jn_A8S1aEvADG8ytqqVN%2B4%2BA%40mail.gmail.com.

Reply via email to