0

I would like to modify the url to access user profile. OSQA use permalink() to generate the profile url
The default link is http://meta.osqa.net/users/2836/nhatthinh
And I want to change it to http://meta.osqa.net/users/nhatthinh
So, I modify the function get_profile_url follow as:

 @models.permalink
    def get_profile_url(self):
        return ('user_profile', [slugify(self.username)])

And I also modify the url in forum\urls.py follow as:

url(r'^%s/(.*)/$' % _('users/'), app.users.user_profile, name='user_profile'),

But the result falls short of my expectation.
OSQA generates a link is http://meta.osqa.net/users//nhatthinh So, how can I fix this issue?
Thank you so much.

Thinh Phan
  • 655
  • 1
  • 14
  • 27

1 Answers1

1

You might want to try it like that:

url(r'^%s/(.*)/$' % _('users'), app.users.user_profile, name='user_profile'),

And if you use tranlsations, do not forget to adapt these as well.

schacki
  • 9,401
  • 5
  • 29
  • 32