gkuhn1 / django-admin-multiupload

Multi file upload for django-admin app
71 stars 64 forks source link

process_uploaded_file takes exactly 3 arguments (4 given) #10

Closed avaika closed 9 years ago

avaika commented 9 years ago

Hi, I'm getting the error from title by default. App was installed into a virtualenv as:

pip install git+git://github.com/gkuhn1/django-admin-multiupload.git

Here is my admin.py where I'm using admin-multiupload. My system is Django==1.6.5 && Python 2.7.8

Though after this change everything works like a charm.

diff --git a/multiupload/admin.py b/multiupload/admin.py
index 226a254..15b88c7 100644
--- a/multiupload/admin.py
+++ b/multiupload/admin.py
@@ -195,8 +195,8 @@ class MultiUploadAdmin(admin.ModelAdmin):
                     f.file.seek(0)

                     # Manipulate file.
-                    data = self.process_uploaded_file(f, object,
-                                                      request)
+                    data = self.process_uploaded_file(f, object)
+                                                      # request)

                     assert 'id' in data, 'Must return id in data'
                     response_data.update(data)

Am I doing something wrong or is it a real issue?

gkuhn1 commented 9 years ago

In latest version there is no kwargs in function process_uploaded_file. To solve this you shold change that function in your ModelAdmin:

-    def process_uploaded_file(self, uploaded, object, **kwargs):
+    def process_uploaded_file(self, uploaded, object, request, **kwargs):
avaika commented 9 years ago

Yep, it works correct that way. Thank you for your help.