Redo our URL scheme to use {% url %} tags

Review Request #359 — Created April 16, 2008 and submitted


Review Board SVN (deprecated)
458, 459


We've been using the old get_absolute_url() function in our templates, which works for the most part but has limitations. Using it on a User object doesn't work so well when installed in a subdirectory, requiring that we prepend SITE_ROOT and then slice the first "/". This gets ugly fast.

We've also been hard-coding other paths ("/account/login/", "/dashboard/", etc.), requiring prepending SITE_ROOT again.

Django's {% url %} tag provides a cleaner solution, allowing us to give certain pages names that we can refer to. Now something like {{SITE_ROOT}}{{submitter.get_absolute_url|slice:"1"}} turns into {% url user submitter %}.

This in theory could also give extensions in the future the ability to override certain pages if they wanted.

The result of this change is that we use get_absolute_url() a lot less for some things and never for users. We could move the rest of the get_absolute_url() calls in the future if we choose, though what we have works for now. We've also eliminated most references to SITE_ROOT in the templates.

There's some misc. fixes and cleanups in here too, such as using djblets's new user_displayname filter.
Made sure every page I tested worked properly in subdirectory installs. All the user links I could find now point to the correct location.
  1. Can you run the unit tests?
    1. Thanks for the review!
  2. Not your fault (this time), but {%endif %} is weird.
    1. Yeah, there seems to be a bit of that throughout some of the templates. Not sure how that happened. I'll fix it before committing.
  3. Also, it'd be nice if you could bump the diffviewer pagination up on this install.  I did it in right now, so an update should be sufficient.