Permalink
Browse files

ADMIN_MEDIA_PREFIX is deprecated in django 1.4

  • Loading branch information...
1 parent 91d0814 commit 1f03dd6480f369795d8620510b7defc6a29452e1 @digitalpbk digitalpbk committed Apr 11, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 django_extensions/admin/widgets.py
@@ -39,7 +39,7 @@ def __init__(self, rel, search_fields, attrs=None):
def render(self, name, value, attrs=None):
if attrs is None:
attrs = {}
- output = [super(ForeignKeySearchInput, self).render(name, value, attrs)]
+ #output = [super(ForeignKeySearchInput, self).render(name, value, attrs)]
opts = self.rel.to._meta
app_label = opts.app_label
model_name = opts.object_name.lower()
@@ -57,10 +57,16 @@ def render(self, name, value, attrs=None):
label = self.label_for_value(value)
else:
label = u''
+
+ try:
+ admin_media_prefix = settings.ADMIN_MEDIA_PREFIX
+ except AttributeError:
+ admin_media_prefix = settings.STATIC_URL + "admin/"
+
context = {
'url': url,
'related_url': related_url,
- 'admin_media_prefix': settings.ADMIN_MEDIA_PREFIX,
+ 'admin_media_prefix': admin_media_prefix,
'search_path': self.search_path,
'search_fields': ','.join(self.search_fields),
'model_name': model_name,

0 comments on commit 1f03dd6

Please sign in to comment.