Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRF models.DurationField warning #78

Closed
jayvdb opened this issue Jun 6, 2020 · 5 comments
Closed

DRF models.DurationField warning #78

jayvdb opened this issue Jun 6, 2020 · 5 comments

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Jun 6, 2020

Describe the bug
DRF DurationField is a string, but is showing a warning.
Warning #35: could not resolve serializer field DurationField(). defaulting to "string"

https://github.com/encode/django-rest-framework/blob/aed7496/rest_framework/fields.py#L1363

https://github.com/django/django/blob/1f817da/django/utils/dateparse.py#L125

Expected behavior
No warnings for core DRF fields.

@tfranzel
Copy link
Owner

tfranzel commented Jun 6, 2020

congratulations on finding probably the last missing field. i guess it got past me because it has not direct mapping in rest_framework.serializers.ModelSerializer.serializer_field_mapping

easy fix

@jayvdb
Copy link
Contributor Author

jayvdb commented Jun 6, 2020

congratulations

thx. I try.

rest_framework.serializers.ModelSerializer.serializer_field_mapping

should that omission be raised upstream?

fwiw, I am happy to do a bunch of these easy fixes so you can focus on that harder ones.
I'm just raising the things I see as I investigate the result on this new generation; only the exception is important, the rest are just ways to reduce the length of the output for the next adoptee.

tfranzel added a commit that referenced this issue Jun 6, 2020
@tfranzel
Copy link
Owner

tfranzel commented Jun 6, 2020

i found that it is not in the list but appended later. so no upstream issue.

sure thing. thanks.

@tfranzel
Copy link
Owner

tfranzel commented Jun 6, 2020

@jayvdb could have added a regex for. that would have been the cherry on top but plain string should do it also. please close on fix confirmation.

@jayvdb
Copy link
Contributor Author

jayvdb commented Jun 7, 2020

Plain string is good enough; can always revisit later. Much appreciated.

@jayvdb jayvdb closed this as completed Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants