Commits

Carl Meyer committed aeaae95

Update to use STATIC_URL.

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
   Griffis.
 
 Settings
 ========
 
-FORM_UTILS_MEDIA_URL
---------------------
-
-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_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``.

form_utils/settings.py

     'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js')
 
 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)

form_utils/widgets.py

 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
 
 try:
     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):
     """

tests/runtests.py

             },
         MEDIA_ROOT=os.path.join(os.path.dirname(__file__), 'media'),
         MEDIA_URL='/media/',
+        STATIC_URL='/static/',
         )
 
     settings.configure(**settings_dict)

tests/test_settings.py

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