Initially posted this to django-users, having completely forgotten
about the existence of django-dev. Sorry about that.

Currently, it is unclear as to how apps that override admin templates
should maintain compatibility with both 1.3 and 1.4 when referring to
the admin media file URLs in the overridden templates. This applies
primarily to third-party apps like django-admin-tools, that want to
support at least the latest two major Django versions.

The changes I'm referring to are ones in the giant r16487 commit
( 
https://github.com/django/django/commit/09cccc395597145d35f3793d57f70b7795214f64
).

Since that change, Django now constructs URLs using `{% static "admin/
css/base.css" %}` internally, instead of the old `{%
admin_media_prefix %}css/base.css` method. That change also saw the
removal of `ADMIN_MEDIA_PREFIX = '/static/admin/'` from
djago.conf.global_settings. This results in the following dilemma for
any app that wishes to maintain compatibility with both 1.3 and 1.4:

To maintain support for 1.3, the app cannot use {% static %}, as it is
not available yet, so it uses {% admin_media_prefix %}, which causes a
PendingDeprecationWarning that we're OK to ignore. However, due to the
removal of the default ADMIN_MEDIA_PREFIX value, the {%
admin_media_prefix %} tag no longer works as expected, returning "css/
base.css" instead of "/static/css/base.css". To overcome this, the app
needs to ask that the project define an ADMIN_MEDIA_PREFIX, or define
one itself, nether of which is desirable. Furthermore, having an
ADMIN_MEDIA_PREFIX defined now triggers a DeprecationWarning, which is
visible, and we're not OK to ignore it anymore.

Of course, the app can provide its own {% admin_media_prefix %} tag,
where it checks for ADMIN_MEDIA_PREFIX first, and returns STATIC_URL/
admin if it's not found, but this seems like the kind of functionality
that should be provided by Django itself, to reduce the number of apps
that will break with the upgrade to 1.4.

I'm happy to write a ticket and a patch, but just wanted to hear from
the core devs' opinion on the issue first.

-- 
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