Re: where are the code that handle image file upload in Django admin page?

2008-12-23 Thread krylatij

http://docs.djangoproject.com/en/dev/topics/http/file-uploads/
here is a sample how to handle file upload

And have tried:
MyForm.save()?
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: where are the code that handle image file upload in Django admin page?

2008-12-22 Thread Chuck22

Anyone can help on this? I get stuck with image file upload.

On Dec 21, 11:33 pm, Chuck22  wrote:
> I have three ImageField in my form and model, I want to know how to
> upload the three image files in the form processing code. I found
> Django Admin page handles the image file upload nicely. And I want to
> do the exactly same work. But I can not find the piece of code that
> does the job when searching the Django source code. Can anyone point
> to me where these code are located? Or share some code snippets
> related to this.
>
> in my model:
>     image1 = models.ImageField(upload_to='img/bk', blank=True)
>     image2 = models.ImageField(upload_to='img/bk', blank=True)
>     image3 = models.ImageField(upload_to='img/bk', blank=True)
>
> in my form processing:
>
> if request.method == 'POST':
>         f = MyForm(request.POST, request.FILES)
>         if f.is_valid():
>             email = f.cleaned_data['email']
>             title = f.cleaned_data['title']
>             ...
>
>             # save the uploaded images
>             for v in request.FILES:
>                 save_upload_file(v)   < this is where i am stuck
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



where are the code that handle image file upload in Django admin page?

2008-12-21 Thread Chuck22

I have three ImageField in my form and model, I want to know how to
upload the three image files in the form processing code. I found
Django Admin page handles the image file upload nicely. And I want to
do the exactly same work. But I can not find the piece of code that
does the job when searching the Django source code. Can anyone point
to me where these code are located? Or share some code snippets
related to this.

in my model:
image1 = models.ImageField(upload_to='img/bk', blank=True)
image2 = models.ImageField(upload_to='img/bk', blank=True)
image3 = models.ImageField(upload_to='img/bk', blank=True)

in my form processing:

if request.method == 'POST':
f = MyForm(request.POST, request.FILES)
if f.is_valid():
email = f.cleaned_data['email']
title = f.cleaned_data['title']
...

# save the uploaded images
for v in request.FILES:
save_upload_file(v)   < this is where i am stuck
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---