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

NoReverseMatch at /account/friendship/users/ Reverse for 'friendship_add_friend' not found. #109

Open
khaldon opened this issue Mar 9, 2020 · 4 comments

Comments

@khaldon
Copy link

khaldon commented Mar 9, 2020

I added the path('friendship/', include('friendship.urls')), in my app's url and then when I go to the url
friendship/users/
it gives me this error
NoReverseMatch at /account/friendship/users/ Reverse for 'friendship_add_friend' not found. 'friendship_add_friend' is not a valid view function or pattern name.
I didn't write any views just an add path inurls.pyin my app

@stodge
Copy link

stodge commented May 6, 2020

I think this happens because your username probably has characters other than a-z or A-Z. I hit this same problem because my username contains a period/full stop (e.g. "."). It's definitely a bug in this module.

@jefftriplett
Copy link
Member

#144 might help on a few edge cases.

@pfcodes
Copy link

pfcodes commented May 13, 2023

I think this happens because your username probably has characters other than a-z or A-Z. I hit this same problem because my username contains a period/full stop (e.g. "."). It's definitely a bug in this module.

This is the case for me.

What's a quick fix to this?

@frankwiles
Copy link
Member

Yeah it looks to be from the slugification of the username.

The easiest thing to do would be to write your own views that used the PK of your User model rather than the username. Would just be a matter of duplicating the included views and adjusting just a little bit. (i.e. User.objects.get(pk=pk) vs User.objects.get(username=username)`

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

5 participants