Permalink
Browse files

Hmm... Some options for flexibility...

  • Loading branch information...
1 parent 02f89af commit 07321a87d67dbc7e416b63964c59f58f24bb5698 @nagisa committed Oct 31, 2011
View
@@ -13,6 +13,8 @@
if not MEDIA_URL and MEDIA_DIRECTORY == settings.MEDIA_ROOT:
MEDIA_URL = settings.MEDIA_URL
+ADMIN_UPDIR = getattr(settings, "BFM_ADMIN_UPLOAD_DIR", '')
+
#PIL installed? Optional dependency.
try:
from PIL import Image
@@ -42,7 +42,7 @@ django.jQuery ->
upload: () ->
csrf_token = $('input[name=csrfmiddlewaretoken]').val()
@xhr = $.ajax_upload @file, {
- url: "/files/upfile/?directory="
+ url: "#{BFMAdminOptions.upload}?directory=#{BFMAdminOptions.updir}"
headers:
"X-CSRFToken": csrf_token
progress: ((e, stats) => @report_progress(e, stats))

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -8,8 +8,9 @@
url(r'^list_files/$', 'django_bfm.views.list_files'),
url(r'^list_directories/$', 'django_bfm.views.list_directories'),
url(r'^file/$', 'django_bfm.views.file_actions'),
- url(r'^upfile/$', 'django_bfm.views.file_upload'),
+ url(r'^upfile/$', 'django_bfm.views.file_upload', name="bfm_upload"),
url(r'^image/$', 'django_bfm.views.image_actions'),
+ url(r'^admin_options/$', 'django_bfm.views.admin_options', name="bfm_opt")
)
if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
View
@@ -5,6 +5,7 @@
from django.http import HttpResponse
from django.core.paginator import Paginator
from django.template import RequestContext
+from django.core.urlresolvers import reverse
import utils
import os
@@ -25,6 +26,14 @@ def base(request):
})
return render_to_response('django_bfm/base.html', c)
+def admin_options(request):
+ opt = {
+ "updir": settings.ADMIN_UPDIR,
+ "upload": reverse("bfm_upload")
+ }
+ options = "BFMAdminOptions = "+simplejson.dumps(opt)+";"
+ return HttpResponse(options)
+
@login_required
@staff_member_required
def list_files(request):

0 comments on commit 07321a8

Please sign in to comment.