Permalink
Browse files

BADGER_MEDIA_{ROOT,URL} settings; quick bugfix to helpers

  • Loading branch information...
1 parent f0ab6bb commit d352e78cb9ae2e380ae03b55a47ba37ffa93f319 @lmorchard committed Jan 16, 2013
Showing with 7 additions and 4 deletions.
  1. +4 −2 badger/admin.py
  2. +1 −0 badger/helpers.py
  3. +2 −2 badger/models.py
View
@@ -1,3 +1,5 @@
+from urlparse import urljoin
+
from django.conf import settings
from django.contrib import admin
@@ -12,8 +14,8 @@
from .models import (Badge, Award, Nomination, Progress, DeferredAward)
-UPLOADS_URL = getattr(settings, 'BADGER_UPLOADS_URL',
- '%suploads/' % getattr(settings, 'MEDIA_URL', '/media/'))
+UPLOADS_URL = getattr(settings, 'BADGER_MEDIA_URL',
+ urljoin(getattr(settings, 'MEDIA_URL', '/media/'), 'uploads/'))
def show_unicode(obj):
View
@@ -1,5 +1,6 @@
import hashlib
import urllib
+import urlparse
from django.conf import settings
View
@@ -88,9 +88,9 @@
# Set up a file system for badge uploads that can be kept separate from the
# rest of /media if necessary. Lots of hackery to ensure sensible defaults.
-UPLOADS_ROOT = getattr(settings, 'BADGER_UPLOADS_ROOT',
+UPLOADS_ROOT = getattr(settings, 'BADGER_MEDIA_ROOT',
os.path.join(getattr(settings, 'MEDIA_ROOT', 'media/'), 'uploads'))
-UPLOADS_URL = getattr(settings, 'BADGER_UPLOADS_URL',
+UPLOADS_URL = getattr(settings, 'BADGER_MEDIA_URL',
urljoin(getattr(settings, 'MEDIA_URL', '/media/'), 'uploads/'))
BADGE_UPLOADS_FS = FileSystemStorage(location=UPLOADS_ROOT,
base_url=UPLOADS_URL)

0 comments on commit d352e78

Please sign in to comment.