From cc21b3d01501af47d22cc8f9819d76672794ea54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Fri, 6 Nov 2015 16:43:21 +0100 Subject: [PATCH] Fixed mediafile serializer and template. Fixed #1650. --- bower.json | 2 +- openslides/mediafiles/serializers.py | 1 - openslides/mediafiles/static/js/mediafiles/site.js | 4 +--- .../static/templates/mediafiles/mediafile-form.html | 2 +- .../static/templates/mediafiles/mediafile-list.html | 4 ++-- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/bower.json b/bower.json index 71c302343..9c4fd3c94 100644 --- a/bower.json +++ b/bower.json @@ -25,6 +25,6 @@ "font-awesome-bower": "4.3.0", "js-data": "~2.3.0", "js-data-angular": "~3.0.0", - "ng-file-upload": "~7.0.17" + "ng-file-upload": "~9.1.2" } } diff --git a/openslides/mediafiles/serializers.py b/openslides/mediafiles/serializers.py index 01946cd93..58b2de0ba 100644 --- a/openslides/mediafiles/serializers.py +++ b/openslides/mediafiles/serializers.py @@ -44,7 +44,6 @@ class MediafileSerializer(ModelSerializer): 'mediafile', 'uploader', 'filesize', - 'filetype', 'timestamp',) def get_filesize(self, mediafile): diff --git a/openslides/mediafiles/static/js/mediafiles/site.js b/openslides/mediafiles/static/js/mediafiles/site.js index 97ba38319..63bd4042f 100644 --- a/openslides/mediafiles/static/js/mediafiles/site.js +++ b/openslides/mediafiles/static/js/mediafiles/site.js @@ -96,9 +96,7 @@ function uploadFile($timeout, $scope, $state, Upload, mediafile) { file.upload = Upload.upload({ url: '/rest/mediafiles/mediafile/' + (mediafile ? mediafile.id : ''), method: mediafile ? 'PUT' : 'POST', - fields: {title: file.title}, - file: file.mediafile, - fileFormDataName: 'mediafile' + data: {mediafile: file.newFile, title: file.title} }); file.upload.then(function (response) { diff --git a/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html b/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html index 1a3924280..16a785f14 100644 --- a/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html +++ b/openslides/mediafiles/static/templates/mediafiles/mediafile-form.html @@ -14,7 +14,7 @@
Current value: {{ mediafile.filename }}
- +
diff --git a/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html b/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html index c3871923d..34564e4b3 100644 --- a/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html +++ b/openslides/mediafiles/static/templates/mediafiles/mediafile-list.html @@ -50,8 +50,8 @@ - {{ mediafile.title_or_filename }} - {{ mediafile.filetype }} + {{ mediafile.title_or_filename }} + {{ mediafile.mediafile.type }} {{ mediafile.filesize }} {{ mediafile.timestamp }} {{ mediafile.uploader }}