> I think that's not a dilemma at all, Django 1.3 requires setting
> ADMIN_MEDIA_PREFIX to an appropriate value as before.

No, that's exactly why this is a problem. Django 1.3 doesn't require
setting ADMIN_MEDIA_PREFIX in the local settings, because it has a
default value that works for most users (i.e. anyone whose STATIC_URL
is /static/). Hence, most Django 1.3 projects I've worked on don't
define an ADMIN_MEDIA_PREFIX in their local settings. It seems
unreasonable for third-party apps to now require it to be set, since
it is now deprecated.

> A certain level of migration is expected (hence the deprecation warnings),
> so it'd be best to include setup instructions in your app's documentation.

That's another part of my point. The deprecation warnings in this case
are not helpful, since the {% admin_media_prefix %} tag simply stops
working as expected without any hints given as to why. For example,
say I have a 1.3 project, without an ADMIN_MEDIA_PREFIX set in the
local settings (I'm happy with the default value). I am also
overriding one of the admin templates, which contains a {%
admin_media_prefix %} tag. I now decide to upgrade to Django 1.4.
Suddenly, my admin CSS and JS stop working, and there's no warnings
that may help explain why this is happening, nor anything in the
release notes.

One of the following two options would solve the problem:

* Make the warning level on the use of {% admin_media_prefix %} match
the warning level of using ADMIN_MEDIA_PREFIX. Right now the former is
a PendingDeprecationWarning, and the latter is a DeprecationWarning.
They should probably both trigger DeprecationWarning.

* Make it clear in the release notes that {% admin_media_prefix %} no
longer works as expected in Django 1.4, and note that this affects
anyone overriding the base admin templates.

Keep in mind that the above only applies to the case of a local Django
project developer. This still doesn't fully address my initial reason
for posting, which is to provide a way for a third-party app that
overrides admin templates to provide compatibility with both 1.3 and
1.4.

> Can you elaborate what you had in mind?

Yes, I think the {% admin_media_prefix %} tag should return something
along the following lines:

getattr(settings, 'ADMIN_MEDIA_PREFIX',
    urjoin(getattr(settings, 'STATIC_URL', ''), 'admin/')

This would allow third party apps to continue using {%
admin_media_prefix %} to provide support for both 1.3 and 1.4. When
1.5 hits, and the PendingDeprecationWarning on {% admin_media_prefix
%} becomes a DeprecationWarning, they will then be able to switch to
using the {% static %} tag to avoid the visible warnings while
providing support for both 1.4 and 1.5.

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