but how to handle the issue then, how can correctly I validate timedelta  
data for DurationField?

On Monday, August 15, 2022 at 7:53:44 AM UTC+2 [email protected] wrote:

> You don't raise exceptions at serializer.
>
> serializer.is_valid(raise_exception=Flase)
>
>
>
> Vào lúc 21:49:54 UTC+7 ngày Thứ Sáu, 12 tháng 8, 2022, Looping Ydobon đã 
> viết:
>
>> Hello,
>>
>> DurationField does not cover cases when input value cannot be converted 
>> to timestamp :
>>
>> timedelta(1000000000) # OverflowError: days=1000000000; must have 
>> magnitude <= 999999999
>> timedelta(100000000000) # OverflowError: Python int too large to convert 
>> to C int
>>
>> Therefore I made a custom/inherited DuurationField class to cover those 
>> cases and tried to raise a ValidationError inside to_internal_value(). 
>> However, only err 500 is visible on GUI side :(
>>
>> Can someone give a hint on where this error is to be handled?
>> Enon
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/9b78c6ba-a99a-43d2-856b-9be8d9031b5bn%40googlegroups.com.

Reply via email to