Hey Marko,
You can achieve the same functionality by creating a custom field (overriding to_native)
The request and view will be available as keys of the .context dict.
However, it might make sense to have a similar method-on-serializer API available.
The only question would be the best way to do that.
Perhaps have the 'source' argument support serializer methods...
class MySerializer(serializers.Serializer):
can_edit = Field(source='get_can_edit')
def get_can_edit(self, obj):
request = self.context['request']
return MyPermissionsClass.can_edit(...)