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 c
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 Thu
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 seriali
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 I
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.ModelSe
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
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 rais
Though you can not achieve what you want by just overriding *validate, *and
not overriding *run_validation*.
This would be a major change in DRF though, as with the current behavior,
when you write your *validate *method, you can assume other validations
passed, so I imagine changing this beha