From 8416850c6756080169bcd3ea3777edd180a68e57 Mon Sep 17 00:00:00 2001 From: Flavio Curella Date: Sun, 3 Apr 2011 13:28:19 -0500 Subject: [PATCH 1/2] Replaced all occurencies of MEDIA_URL with STATIC_URL, to make it compatible with Django's collectstatic command --- src/orderable/admin.py | 6 +++--- src/orderable/settings.py | 8 ++++---- src/orderable/{media => static}/orderable/orderable.js | 0 src/orderable/tests/settings.py | 4 ++-- src/orderable/tests/urls.py | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) rename src/orderable/{media => static}/orderable/orderable.js (100%) diff --git a/src/orderable/admin.py b/src/orderable/admin.py index 6015d66..c623755 100644 --- a/src/orderable/admin.py +++ b/src/orderable/admin.py @@ -2,7 +2,7 @@ from django import forms from django.contrib import admin -from orderable.settings import JQUERY_URL, JQUERYUI_URL, ORDERABLE_MEDIA_URL +from orderable.settings import JQUERY_URL, JQUERYUI_URL, ORDERABLE_STATIC_URL class OrderableAdmin(admin.ModelAdmin): exclude = ('order',) @@ -13,7 +13,7 @@ class OrderableAdmin(admin.ModelAdmin): class Media: js = (JQUERY_URL, JQUERYUI_URL, - posixpath.join(ORDERABLE_MEDIA_URL, 'orderable/orderable.js')) + posixpath.join(ORDERABLE_STATIC_URL, 'orderable/orderable.js')) def __init__(self, *args, **kwargs): super(OrderableAdmin, self).__init__(*args, **kwargs) @@ -28,7 +28,7 @@ class OrderableInline(object): class Media: js = (JQUERY_URL, JQUERYUI_URL, - posixpath.join(ORDERABLE_MEDIA_URL, 'orderable/orderable.js')) + posixpath.join(ORDERABLE_STATIC_URL, 'orderable/orderable.js')) class OrderableStackedInline(OrderableInline, admin.StackedInline): template = 'orderable/edit_inline/stacked.html' diff --git a/src/orderable/settings.py b/src/orderable/settings.py index 5aa3bb3..de2fc1c 100644 --- a/src/orderable/settings.py +++ b/src/orderable/settings.py @@ -8,13 +8,13 @@ def is_valid(url): 'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js') if not is_valid(JQUERY_URL): - JQUERY_URL = posixpath.join(settings.MEDIA_URL, JQUERY_URL) + JQUERY_URL = posixpath.join(settings.STATIC_URL, JQUERY_URL) JQUERYUI_URL = getattr(settings, 'JQUERYUI_URL', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.7/jquery-ui.min.js') if not is_valid(JQUERYUI_URL): - JQUERYUI_URL = posixpath.join(settings.MEDIA_URL, JQUERYUI_URL) + JQUERYUI_URL = posixpath.join(settings.STATIC_URL, JQUERYUI_URL) -ORDERABLE_MEDIA_URL = getattr(settings, 'ORDERABLE_MEDIA_URL', - settings.MEDIA_URL) +ORDERABLE_STATIC_URL = getattr(settings, 'ORDERABLE_STATIC_URL', + settings.STATIC_URL) diff --git a/src/orderable/media/orderable/orderable.js b/src/orderable/static/orderable/orderable.js similarity index 100% rename from src/orderable/media/orderable/orderable.js rename to src/orderable/static/orderable/orderable.js diff --git a/src/orderable/tests/settings.py b/src/orderable/tests/settings.py index 832d0e0..72af3db 100644 --- a/src/orderable/tests/settings.py +++ b/src/orderable/tests/settings.py @@ -21,5 +21,5 @@ ROOT_URLCONF = 'orderable.tests.urls' -MEDIA_ROOT = os.path.join(ORDERABLE_ROOT, 'media') -MEDIA_URL = '/static/' \ No newline at end of file +STATIC_ROOT = os.path.join(ORDERABLE_ROOT, 'static') +STATIC_URL = '/static/' \ No newline at end of file diff --git a/src/orderable/tests/urls.py b/src/orderable/tests/urls.py index f230920..6ae7e63 100644 --- a/src/orderable/tests/urls.py +++ b/src/orderable/tests/urls.py @@ -10,8 +10,8 @@ view = include(site.urls), ), url( - regex = r'^%s(?P.*)$' % settings.MEDIA_URL[1:], + regex = r'^%s(?P.*)$' % settings.STATIC_URL[1:], view = 'django.views.static.serve', - kwargs = {'document_root': settings.MEDIA_ROOT} + kwargs = {'document_root': settings.STATIC_URL} ), ) \ No newline at end of file From 3d87bd54cfccc97822bc5cc9079ae07693cd9601 Mon Sep 17 00:00:00 2001 From: Flavio Curella Date: Sun, 3 Apr 2011 14:19:51 -0500 Subject: [PATCH 2/2] updated MANIFEST.in and setup.py with new STATIC path --- MANIFEST.in | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 5a8ea95..0e2f3f1 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,4 +2,4 @@ include README.markdown include LICENSE.markdown recursive-include src/orderable/locale * recursive-include src/orderable/templates *.html -recursive-include src/orderable/media *.js +recursive-include src/orderable/static *.js diff --git a/setup.py b/setup.py index 844bc1f..f6e1e8b 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ 'templates/orderable/change_list.html', 'templates/orderable/edit_inline/stacked.html', 'templates/orderable/edit_inline/tabular.html', - 'media/orderable/orderable.js', + 'static/orderable/orderable.js', 'locale/*/LC_MESSAGES/django.*', ] },