I have a serilizer. I have overridden the to_representation
method of the serializer. I want to use the view name for which the serializer code has been invoked. I tried the following::
self.context['view'].__class__
This returns me the following::
<class 'search.api.v1.views.JobSearchList'>
However, I just want the name of the view class. i.e. JobSearchList
Any idea how I can go about doing this?
I can get the name by
self.context['view'].__class__.__name__
# or type(self.context['view']).__name__ something like that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With