Carl Meyer  committed aeaae95

Update to use STATIC_URL.

  • Participants
  • Parent commits f286086
  • Branches default

Comments (0)

Files changed (6)

 tip (unreleased)
+- Removed ``FORM_UTILS_MEDIA_URL`` setting and updated to use ``STATIC_URL``
+  rather than ``MEDIA_URL`` throughout. (May be backwards-incompatible.)
 - Added "error" class to row_attrs for fields with errors. Thanks Aron
-Some projects separate user-uploaded media at ``MEDIA_URL`` from
-static assets. If you keep static assets at a URL other than
-``MEDIA_URL``, just set ``FORM_UTILS_MEDIA_URL`` to that URL, and make
-sure the contents of the ``form_utils/media/form_utils`` directory are
-available at ``FORM_UTILS_MEDIA_URL/form_utils/``.
     JQUERY_URL = 'jquery.min.js'
-This will use the jQuery available at MEDIA_URL/jquery.min.js. Note
-that a relative ``JQUERY_URL`` is always relative to ``MEDIA_URL``, it
-does not use ``FORM_UTILS_MEDIA_URL``.
+This will use the jQuery available at STATIC_URL/jquery.min.js. Note
+that a relative ``JQUERY_URL`` is relative to ``STATIC_URL``.

File form_utils/

 if not ((':' in JQUERY_URL) or (JQUERY_URL.startswith('/'))):
-    JQUERY_URL = posixpath.join(settings.MEDIA_URL, JQUERY_URL)
-FORM_UTILS_MEDIA_URL = getattr(settings, 'FORM_UTILS_MEDIA_URL', settings.MEDIA_URL)
+    JQUERY_URL = posixpath.join(settings.STATIC_URL, JQUERY_URL)

File form_utils/

 from django.conf import settings
 from django.utils.safestring import mark_safe
-from form_utils.settings import JQUERY_URL, FORM_UTILS_MEDIA_URL
+from form_utils.settings import JQUERY_URL
     from sorl.thumbnail.main import DjangoThumbnail
                                     'checkbox': rendered_widgets[1]}
         return rendered_widgets[0]
-root = lambda path: posixpath.join(FORM_UTILS_MEDIA_URL, path)
+root = lambda path: posixpath.join(settings.STATIC_URL, path)
 class AutoResizeTextarea(forms.Textarea):

File tests/

         MEDIA_ROOT=os.path.join(os.path.dirname(__file__), 'media'),
+        STATIC_URL='/static/',

File tests/

 MEDIA_ROOT = join(dirname(__file__), 'media')
 MEDIA_URL = '/media/'
+STATIC_URL = '/static/'