Wednesday, January 14, 2009

New Admin URLs

I'm very happy to announce that with revision 9739 of Django the admin now uses normal URL resolvers and its URLs can be reversed. This is a tremendous improvement over the previous ad hoc system and it gives users the distinct advantage of being able to reverse the admin's URLs. However, in order to make this work a new feature went into the URL resolving system that any user can use in their own code.

Specifically users can now have objects which provide URLs. Basically this is because include() can now accept any iterable, rather than just a string which points to a urlconf. To get an idea of what this looks like you can look at the way the admin now does it.

There are going to be a few more great additions to Django going in as we move towards the 1.1 alpha so keep an eye out for them.


  1. Rock on! Thanks for the amazing work!

  2. Does that mean that I can get the URL to a specific model's admin add page with reverse() and {% url ... %}? What would it look like for e.g. a model "bar" in app "foo"? I was unable to find out myself.

  3. Ok, I found it. Something like reverse('admin_foo_bar_add') should work. Found out by checking the source code.


Note: Only a member of this blog may post a comment.