Re: Multiple File Upload???
Ok, as a reminder, here is the Image model I am using: class Image(models.Model): altText = models.CharField(maxlength = 128, null = True, blank = True) picture = models.ImageField(upload_to='img/%Y/%m') The problem is that i want to create multiple objects of this type from a single upload form (and thus uploading multiple files) > Your request appears to have multiple files in it, which suggests that your > template is working fine. As far as I can see, all that remains is to pass > your request into the Description Manipulator to get_validation_errors, > do_html2python, and save. This process should handle writing the files to > disk. Well No, not exactly, and that's why started this thread. If I call those methods, only one file (the last one in the form) will get uploded and its data saved to the database. The rest of the files in the post request seem to be lost. The problem relies on the fact that FormWrapper seems to be associated to one manipulator, and that the manipulator is in turn created by AddManipulator(), a method from each Model. The Image model would have to have multiple ImageField fields so that django can save them all, but anyways that would create *a single Image Object* So Apparently, if i want to upload multiple files and create with them an equal number of Image objects, it seems to me that i have to do it "one by one" (an upload for each post request). I will try by creating multiple FormWrappers, but I think that will imply knowing how many files will be uploaded, which is not exactly cool. Anyways, thanks a lot for your replies. I will keep trying and let you know what i found. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Multiple File Upload???
Russ, thanks a lot for your reply. I have tried the `edit_inline' thing, and it works fine in the admin interface. In fact, what I want to do is to achieve that but not only in the admin views but _also_ in my public intefrace views... And that's where i have this problem. I'm willing to write some javascript if necessary, but i think the first part would be to be able to upload 2 different Images in the same view! I i do: for f in request.FILES.getlist('picture_file'): print('-') myMVD = {'picture_file': f} I see this in the output: - {'picture_file': {'content': '\x89PNG\r\n\x1a\n\x00\x00\\x00IEND\xaeB`\x82', 'content-type': 'image/png', 'filename': 'back.png'}} - {'picture_file': {'content': '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00.x00\x00\x00IEND\xaeB`\x82', 'content-type': 'image/png', 'filename': 'binary.png'}} Is there anyway that i can catch those and pass them to django Manipulator's do_html2python() and save() methods? Thank you so much for your help! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Multiple File Upload???
Ok, the problem then is, that my model has just a single entity called picture. What I'm trying to do is asociate multiple image files to multiple `descriptions'. I'm doing this by a intermedaite table: #Images to be used in descriptions class Image(models.Model): altText = models.CharField(maxlength = 128, null = True, blank = True) picture = models.ImageField(upload_to='img/%Y/%m') ... # Replaces the Many-to-Many Relationship class ImageInDescription(models.Model): description = models.ForeignKey(Description, edit_inline=models.TABULAR, num_in_admin=3) image = models.ForeignKey(Image, core = True) ... #Descriptions class Description(models.Model): lang = models.ForeignKey(Lang) description = models.TextField(null = True, blank = True) ... That's it. So as you can see in the first class, `Image' is itself an element to be uploaded. I guess I could add more ImageFields to the model but that would't make sense, would it? Isn't there a way to upload as many files as i want to (much like gmail handles attatchments) and then associating them to the descriptions? Russell Keith-Magee wrote: > On 8/29/06, cerealito <[EMAIL PROTECTED]> wrote: > > > > > > Hi everyone, > > > > I am trying to upload multiple image files in one of my projects. > > Single-File upload works fine, but how do I Get to upload many files in > > the same form? > > ... > > > But my question is... How do I "save" them? > > > > imageManipulator.do_html2python(new_data) > > imageManipulator.save(new_data) > > > > Wouldn't work... > > > It should do. As long as your model contains multiple FileField entries, the > manipulator should quite happily save the files, one file per file field per > form. Can you share your actual model, view and template (or pruned versions > of them)? > > Yours, > Russ Magee %-) > > --=_Part_61688_22258181.1156811004015 > Content-Type: text/html; charset=ISO-8859-1 > X-Google-AttachSize: 1132 > > On 8/29/06, class="gmail_sendername">cerealito <mailto:[EMAIL > PROTECTED]">[EMAIL PROTECTED]> wrote: class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: > 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> > Hi everyone,I am trying to upload > multiple image files in one of my projects.Single-File upload works fine, > but how do I Get to upload many files inthe same > form?... > But my question is... How do I "save" > them?imageManipulator.do_html2python(new_data)imageManipulator.save(new_data)Wouldn't > work...It should do. As long as your model contains > multiple FileField entries, the manipulator should quite happily save the > files, one file per file field per form. Can you share your actual model, > view and template (or pruned versions of them)? > Yours,Russ Magee %-) > > --=_Part_61688_22258181.1156811004015-- --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Multiple File Upload???
Hi everyone, I am trying to upload multiple image files in one of my projects. Single-File upload works fine, but how do I Get to upload many files in the same form? I have many of these in the templates: {{ form.picture }} {{ form.picture_file }} Then on my views i have: for file in request.FILES.getlist('picture_file'): print( file )# i can see the dictonary-like objects in the server output... But my question is... How do I "save" them? imageManipulator.do_html2python(new_data) imageManipulator.save(new_data) Wouldn't work... Can anybody point me into the right direction? I've been browsing through the docs and I couldn't find any useful info. I'm sure someone has already passed through this. I would really appreciate any clue. Thanks in advance. Django Fan and Newbie #6134 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Urls not matched in production mode [n00b]
Yup, That made it... Thanks a lot! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Urls not matched in production mode [n00b]
Hi everyone, I've been having a great time testing Django and developing a real application. However, I've run into some trouble putting my project in a production environment: Everything works fine in using the development sever, but when I try to put my project under Apache and mod_python, I get the Django 404 debug page, indicating that the URL entered [i.e. http://myhost/metadata/ ] did not match any patterns in my urls.py: "Using the URLconf defined in metadata.urls, Django tried these URL patterns, in this order: 1. ^admin/ 2. ^$ 3. ^all/$ 4. ^packages/(?P\d+)/$ ... 9. ^description/create/(?P\d+)/$ 10. ^accounts/login/$ 11. ^logout/$ 12. ^i18n/ The current URL, /metadata/, didn't match any of these." I just want to have a very basic configuration, so I'm using this under my httpd.conf: SetHandler python-program PythonHandler django.core.handlers.modpython PythonPath "['/home/cerealito'] + sys.path" SetEnv DJANGO_SETTINGS_MODULE metadata.settings PythonDebug On As you can guess from here, my project is called `metadata' and lives under `/home/cerealito/metadata' I've browsed through the list and the tickets, and I could not find any help. Am I missing something basic here? Any hint would be appreciated. Thanks a lot! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---