Hello,

I'm starting with Django, so I was adviced to use the newforms. But I  
can't just figure out how to correctly upload images (or other files  
for that matter). I heard that there was already much discussion on  
this list, but on groups.google.com I couldn't find any pointers.

I tried out two code examples from blogs, but get stuck with both.

First I tried this one:
http://www.oluyede.org/blog/2007/03/18/django-image-uploading- 
validation-and-newforms/
The strange thing about this example is that part of the validation  
happens in the view (not in the clean_photo method of the Form).
I got stuck with this, because this (line 6 , in views):
                 img = Image.open(StringIO(request.FILES['photo'] 
['content']))
kept failing. I would like to test this behavior of Image in the  
django shell, but wouldn't know how.

Then I tried
http://batiste.dosimple.ch/blog/2007-05-13-1/
which claims to be based on the former example, but seems quite  
different to me. Probably the reason why I can't get this to work is  
my lack of understanding the monkey-patching business.
The strange thing here (i.e. the part where I get lost), is that the  
clean_avatar method takes two arguments clean_avatar(self, value),  
but I have no idea where this other argument should be coming from.
(Django has the same problem: TypeError at /upload/  clean_photo()  
takes exactly 2 arguments (1 given))

I'm using 0.96

I was hoping you guys could lead me towards working image upload. ;-)

best
dirk



-----------------------------
Dirk van Oosterbosch
de Wittenstraat 225
1052 AT Amsterdam
the Netherlands

http://labs.ixopusada.com
-----------------------------



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to