Change get_absolute_url for the user object in Django

September 16, 2010   

I completely overlooked this in the docs. So if you are here you either didn’t look in the docs or overlooked it also.

I was doing something like this

return (user.get_absolute_url(), (), {})

Now that sends the user to

/user/username/

I wanted the user to go to

/u/username/

So in your settings.py file just do this

ABSOLUTE_URL_OVERRIDES = {
    'auth.user': lambda o: "/u/%s/" % o.username,
}


comments powered by Disqus