Django 1.1: LogOut links apparently broken

I lost quite a few hours on this, but the solution was simple. The other day I realized that all the Log-in / Log-out hyperlinks in the admin were messing things up in various ways.

Either by inserting a mysterious ‘None’ string in the url, or by adding the necessary url terminations (/logout, /login) to the wrong place (e.g. /admin/application_name/logout instead of /admin/logout). Tried to google this a bit, found some results but nothing was apparently related..

Basically what happened is that when upgrading to Django 1.1. I didn’t update also the base.html file in my templates/admin … small thing really, but as I said it did manage to give me a headache.
So, advice is, when upgrading make sure to update all the admin templates you’re making use of (e.g. for customizing them)!. Follows an example of how the upgrade has changed things in base.html..

# in admin/base.html

# used to be:
<a href="{{ root_path }}logout/">{% trans 'Log out' %}</a>

# instead now is:
{% url admin:logout as logout_url %}

 

Share/Bookmark






One Response to “Django 1.1: LogOut links apparently broken”

Thanks a lot, saved me a bunch of time.

Reece Heinlein added these pithy words on Nov 30 09 at 3:28 pm