Hi all,

We have a first [1]patch ready for review and feedback for this
[2]ticket.  It is strongly based on one Florian Apolloner had posted to
ticket #13588.

It's about removing as many hard-coded '../../..'-prefixed URLs in
Python code and templates of the admin app as possible.

Some notes and questions:

o It implements the same changes for ForeignKeyRawIdWidget and
  ManyToManyRawIdWidget admin-specific widgets, e.g. it changes their
  __init__ to add a adminSite instance argument.

o AdminSite.root_path is removed for good.

o We added an inner template block inside breadcrumbs one, we called it
  crumbs, among other cleanups in the breadcrumbs code. Is it worth it?

o It adds a new template tag library 'admin_urls'  with a very simple
  'model_url' tag that needs to receive the app name, the model name and
  that returns it's URL in the current admin site.  Ideas for a better
  implementation are welcome.

o It also removed the hard-coded URLS in the  admindocs app! This is
  thanks to Dario Ocles that spotted this omission and worked on
  implementing the needed changed.

o It included one test that involves a model with CharField PK, one
  instance of such model has a 'add'  value whose -change_view' form URL
  clashes with the 'add_view' form URL. To workaround the clash, the URL
  for 'add_view' is changed to .../!add/ making use of the patch
  functionality.

o That test environment revealed a strange trait of the URL resolving
  machinery in the admin *:

  If one wants to add an URL when there is already one with the
  same name (e.g. 'appname_modelname_add') you can't simply append it to
  the end or insert it at the front of the url patters list returned by
  your ModelAdmin.get_urls() because it either is ignored or breaks
  resolution of other URLs realted to you model. You need either to
  remove the existing entry first or re-define all the URLs related to
  the model in your ModelAdmin.get_urls() simply to only change one of
  them. I don't knw if we should consider this a bug on its own.
  Opinions welcome.

  * Actually, I 've had no time to check if this a more general problem
    of the URL routing framework or if it only affects the admin URLs.

Regards,

-- 
Ramiro Morales

1. https://code.djangoproject.com/attachment/ticket/15294/15294.1.diff
2. https://code.djangoproject.com/ticket/15294

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to