Skip to content

Commit

Permalink
Use configured storage for file uploads. Closes #145.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenmcd committed Aug 24, 2016
1 parent 52be9a3 commit b5ef5c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions forms_builder/example_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
SECRET_KEY = "asdfa4wtW#$Gse4aGdfs"
ADMINS = ()

FORMS_BUILDER_UPLOAD_ROOT = os.path.join(PROJECT_ROOT, "secret")


MANAGERS = ADMINS
if "test" not in sys.argv:
Expand Down
7 changes: 5 additions & 2 deletions forms_builder/forms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import django
from django import forms
from django.forms.extras import SelectDateWidget
from django.core.files.storage import FileSystemStorage
from django.core.files.storage import default_storage
from django.core.urlresolvers import reverse
from django.template import Template
from django.utils.safestring import mark_safe
Expand All @@ -20,7 +20,10 @@
from forms_builder.forms.utils import now, split_choices


fs = FileSystemStorage(location=settings.UPLOAD_ROOT)
fs = default_storage
if settings.UPLOAD_ROOT is not None:
fs = default_storage.__class__(location=settings.UPLOAD_ROOT)


##############################
# Each type of export filter #
Expand Down

0 comments on commit b5ef5c9

Please sign in to comment.