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

Allow None for HyperlinkedRelatedField.get_url(format=) parameter #485

Merged
merged 2 commits into from Oct 18, 2023

Conversation

4c0n
Copy link
Contributor

@4c0n 4c0n commented Oct 12, 2023

I have made things!

Hi! I ran into a false positive when running mypy in combination with this package.
Actually the format parameter can also be None in the get_url() method, it is passed to reverse() where the default value also is None. We've been using it like this in our application for a long time and it works fine like that.
Please see:
https://github.com/encode/django-rest-framework/blob/3.14.0/rest_framework/relations.py#L326
https://github.com/encode/django-rest-framework/blob/3.14.0/rest_framework/reverse.py#L32

Thanks in advance for your time and consideration.

Related issues

I didn't create an issue, should I?

@intgr intgr changed the title format may be None Allow None for HyperlinkedRelatedField.get_url(format=) parameter Oct 18, 2023
@intgr intgr self-assigned this Oct 18, 2023
Copy link
Contributor

@intgr intgr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I didn't create an issue, should I?

No need. Only for more complex changes that you think warrant prior discussion.

@intgr intgr merged commit c06c06a into typeddjango:master Oct 18, 2023
11 checks passed
@4c0n 4c0n mentioned this pull request Oct 23, 2023
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants