Re: Skip an object in ListView

2020-07-01 Thread DIPENDRA BHATT
Happy to help, Though if you list your exact requirements and what you done to solve them, we might be able to provide much concise and standard solution instead of writing some hacky code. On Thu, Jul 2, 2020, 1:51 AM Gagan Deep wrote: > Thanks for such a prompt response. > > I am catching a

Re: Skip an object in ListView

2020-07-01 Thread Gagan Deep
Thanks for such a prompt response. I am catching a custom exception here. I don't think filtering the queryset will solve the problem since the exception is raised after performing some operation on properties of object. I will explore if it can be done through validation. Thanks again!  On

Re: Skip an object in ListView

2020-07-01 Thread DIPENDRA BHATT
Serializermethodfield is a read only field used to append some custom data to the serialization of objects. If you wanna skip this object in case a exception occurs to fetch the custom field, this probably was a validation/filtering issue on the quesryset part which is being supplied to the

Re: Skip an object in ListView

2020-07-01 Thread Brent O'Connor
What exception is it throwing? On Wednesday, July 1, 2020 at 2:49:46 PM UTC-5, Gagan Deep wrote: > > 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

Skip an object in ListView

2020-07-01 Thread Gagan Deep
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

Re: Django Rest Framework Validation Order Issue

2020-07-01 Thread Brent O'Connor
Hi Özgür, I'm not sure if you saw it or not but I did come up with a solution in another branch (https://github.com/epicserve/drf-validation-issue/blob/fix-validation/pizzas/serializers.py) and I did end up overriding *run_validation* and *to_internal_value*. If I can find time, I think I'll

Re: Django Rest Framework Validation Order Issue

2020-07-01 Thread Özgür Akçalı
I think you also need to override *run_validators *method in your example project for it to work as you expect, just like you did for *to_internal_value. *If a validation error is raised fom run_validators method, *validate *method is not called, so you can not aggregate any possible errors