Open JerryMartinsonLeviti opened 1 year ago
Yes, it is basically that. But note that this will require a new scalar too, and I think that scalar should go do https://github.com/strawberry-graphql/strawberry/blob/main/strawberry/schema/types/base_scalars.py
Basically a scalar named Timedelta
that serializes to .total_seconds()
and parsers the seconds as a timedelta
object
Then you just need to map the DurationField
to datetime.timedelta
in this lib and it is done
Feature Request Type
Description
I use DurationFields a fair amount in Django and I noticed that they don't seem to be supported. Digging through the code a bit, I think it could be added by changing
.../strawberry_django/fields/types.py
in the following way:Adding
fields.DurationField: datetime.timedelta
to thefield_type_map
dict
between line 70 & 71.I'm a total newbie to any contributory activity, so I'm not sure if there's a better way to submit this.
Upvote & Fund