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

Handle reversal of non-API view_name in HyperLinkedRelatedField #2724

Merged

Conversation

delinhabit
Copy link
Contributor

@delinhabit delinhabit commented Mar 19, 2015

This fixes #2711

@tomchristie
Copy link
Member

tomchristie commented Mar 19, 2015

I wonder if we should handle this in a more generic way - eg in the reverse function...

https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/reverse.py#L18

Wrap the scheme.reverse in a NoReverseMatch block and fallback to the none-versioned approach there?

@delinhabit
Copy link
Contributor Author

delinhabit commented Mar 19, 2015

Yeah, I think you are right. I'll try do do that.

@delinhabit
Copy link
Contributor Author

delinhabit commented Mar 19, 2015

Moved the fallback logic to reverse and added tests around the new behavior in test_reverse.py

@tomchristie
Copy link
Member

tomchristie commented Mar 20, 2015

Excellent!

@tomchristie
Copy link
Member

tomchristie commented Mar 23, 2015

Stupidly I managed to miss this for the 3.1.1 release - apologies.
Merging now so it'll be in for 3.1.2.

tomchristie added a commit that referenced this pull request Mar 23, 2015
…i-reversal

Handle reversal of non-API view_name in HyperLinkedRelatedField
@tomchristie tomchristie merged commit a90dbe3 into encode:master Mar 23, 2015
@delinhabit delinhabit deleted the namespaced-versioning-non-api-reversal branch Apr 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't reverse non-API URLs with NamespaceVersioning
2 participants