Re: newforms and File (image) upload
On 6/21/07, Dirk van Oosterbosch, IR labs <[EMAIL PROTECTED]> wrote: > > On 20-jun-2007, at 22:19, SanPy wrote: > > > File and image uploading for newforms, AFAIK, is not implemented in > > 0.96. There is a ticket for this (#3297). If you look in the django- > > developers newsgroup and search for #3297, you will find more > > information. It is possible to have it working with the latest trunk > > from SVN and a patch from #3297. It works fine on my machine with the > > latest trunk and patch. > > Hi Sander, > > Thanks for the pointers on this one, > > There seems to be an incompatibility between the latest trunk (rev 5505) and > the last (06/13/07) patch for #3297. More on this below. I was looking at this a few weeks ago before I got sent to the ends of the earth by my employer; I'm back now, so I'm hoping to get back into this problem. > Question: can I mix and match oldforms and newforms together? (in the same > application that is, not in the same view or form obviously). Sure. One view uses newforms, another view uses oldforms; as long as you import both as required, there is no potential for crossover between the two. In fact, if you're deploying the admin app, you're already using both. The current trunk admin uses oldforms (though not for long). Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: newforms and File (image) upload
On 20-jun-2007, at 22:19, SanPy wrote: > File and image uploading for newforms, AFAIK, is not implemented in > 0.96. There is a ticket for this (#3297). If you look in the django- > developers newsgroup and search for #3297, you will find more > information. It is possible to have it working with the latest trunk > from SVN and a patch from #3297. It works fine on my machine with the > latest trunk and patch. Hi Sander, Thanks for the pointers on this one, There seems to be an incompatibility between the latest trunk (rev 5505) and the last (06/13/07) patch for #3297. More on this below. But my main problem at the moment is that my host doesn't like the idea of getting a -possibly- unstable trunk version with a patch on top. So I guess I have to figure it out with the current 0.96 version and various examples. I found another one at http:// www.djangosnippets.org/snippets/95/ which helped me just a tidbit further. Question: can I mix and match oldforms and newforms together? (in the same application that is, not in the same view or form obviously). (En bedankt voor de code voorbeelden, ook al kan ik die dus niet op de server gebruiken) best dirk The incompatibility between the latest trunk (rev 5505) and the last patch on http://code.djangoproject.com/ticket/3297 : filefield_with_newforms_admin_integration_cleaner.diff (20.2 kB) - added by Øyvind Saltvik <[EMAIL PROTECTED]> on 06/13/07 05:19:27. see this excerpt output from the command [ /django_src]% patch -p0 < filefield_with_newforms_admin_integration_cleaner.diff [...] can't find file to patch at input line 302 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -- |Index: django/contrib/admin/options.py |=== |--- django/contrib/admin/options.py(revision 5457) |+++ django/contrib/admin/options.py(working copy) -- File to patch: Skip this patch? [y] Skipping patch. 2 out of 2 hunks ignored patching file django/contrib/admin/urls.py Hunk #1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file django/contrib/admin/ urls.py.rej [...] - 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 -~--~~~~--~~--~--~---
Re: newforms and File (image) upload
Dirk, File and image uploading for newforms, AFAIK, is not implemented in 0.96. There is a ticket for this (#3297). If you look in the django- developers newsgroup and search for #3297, you will find more information. It is possible to have it working with the latest trunk from SVN and a patch from #3297. It works fine on my machine with the latest trunk and patch. Als je er niet uitkomt, laat het hier dan even weten, dan geef ik je wat code voorbeelden. Groet, Sander. On 20 jun, 18:15, "Dirk van Oosterbosch, IR labs" <[EMAIL PROTECTED]> wrote: > 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 triedhttp://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 -~--~~~~--~~--~--~---
newforms and File (image) upload
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 -~--~~~~--~~--~--~---