django-friendship icon indicating copy to clipboard operation
django-friendship copied to clipboard

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

Open khaldon opened this issue 4 years ago • 4 comments

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

khaldon avatar Mar 09 '20 18:03 khaldon

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.

stodge avatar May 06 '20 20:05 stodge

#144 might help on a few edge cases.

jefftriplett avatar Aug 26 '21 00:08 jefftriplett

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?

pfcodes avatar May 13 '23 03:05 pfcodes

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)`

frankwiles avatar May 15 '23 15:05 frankwiles