Fixed broken downloads

This commit is contained in:
Fergal Moran
2013-06-20 11:39:18 +01:00
parent 8c554bd734
commit c825c6afff
3 changed files with 8 additions and 5 deletions

View File

@@ -30,9 +30,8 @@ def download(request, mix_id):
if mix is not None:
if mix.download_allowed:
mix.add_download(request.user)
filename = mix.local_file.path # Select your file here.
file, ext = os.path.splitext(filename)
response = sendfile(request, filename, attachment=True, attachment_filename="%s.%s" % (mix.title, ext))
filename = "%s/mixes/%s.mp3" % (here(settings.MEDIA_ROOT), mix.uid)
response = sendfile(request, filename, attachment=True, attachment_filename="Deep South Sounds - %s.mp3" % mix.title)
return response
except Exception, ex:
print ex

View File

@@ -119,9 +119,9 @@ define ['moment', 'app', 'vent', 'marionette', 'utils', 'models/comment/commentC
true
mixDownload: ->
console.log("MixItemView: mixDownload")
utils.downloadURL("/audio/download/" + @model.get('id'))
true
return false;
MixItemView

View File

@@ -156,7 +156,11 @@
return true;
};
MixItemView.prototype.mixDownload = function() {};
MixItemView.prototype.mixDownload = function() {
console.log("MixItemView: mixDownload");
utils.downloadURL("/audio/download/" + this.model.get('id'));
return true;
};
return MixItemView;