Skip to content

Update 6-viewsets-and-routers.md #8493

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

Closed
wants to merge 3 commits into from

Conversation

dmitrijBerg
Copy link

Motivation

Following part 6 of the tutorial, I encountered following error:

Could not resolve URL for hyperlinked relationship using view name "user-detail". You may have failed to include the related model in your API, or incorrectly configured the `lookup_field` attribute on this field.

After some debugging I tracked the problem down to two lines of code at the very end.

Description

The basename values users and snippets break the automatic creation of urlpatterns. Instead, it should be user and snippet.

The basenames `users` and `snippets` break the automatic creation of urlpatterns. Instead, it should be `user` and `snippet`.
@tomchristie
Copy link
Member

tomchristie commented Jun 8, 2022

Resolved in #8517

(And ooops, yes I see that this one came first, thanks anyway)

@tomchristie tomchristie closed this Jun 8, 2022
@dmitrijBerg dmitrijBerg deleted the patch-1 branch June 11, 2022 09:56
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

Successfully merging this pull request may close these issues.

2 participants