I have a SerializerMethodField in serializer. I am catching an exception in 
the function like below. I want to skip this object in the ListView 
entirely if that exception is caught. How can I do this? 

I am using ListApiView from rest_framework.generics 

 
classFooSerializer(serializers.ModelSerializer):
    foo = serializers.SerializerMethodField()
   
    get_foo(self, object):
    try:
        # Do something here
    except:
    # If an exception is captured than skip this object


-- 
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 django-rest-framework+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/634738be-bc9d-4178-86f2-252b96430996o%40googlegroups.com.

Reply via email to