Thanks Louis,

It has taken me a while to get my head wrapped around this.  Your 
suggestions helped and I am now moving along. 

Tonu

Louis Sayers wrote:
> Firstly, make sure that you have the enctype="multipart/form-data"
> attribute on your form in your template.
>
> You can create an object of your form by writing:
> formObject = BookmarkSaveForm(request.POST, request.FILES)
>
> test if it's valid:
> if formObject.is_valid():
>
>
> Looking at your Photo model, you are probably wanting a modelForm
> instead of creating a new form.  If you haven't already seen the
> documentation at djangoproject.com under the documentation tab, now
> might be a good place to look.  For modelForms, there's a good bit of
> doc at 
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-forms-modelforms
>
> I hope this helps at least a little.
>
>
> On Feb 13, 9:23 am, Tonu Mikk <tm...@umn.edu> wrote:
>   
>> Hello, I am having trouble writing a view to upload images. I am
>> creating a bookmarks application with Django 1.02 that would have a
>> screenshot for each bookmark.  I extended the model in this way to
>> include the images:
>>
>> class Photo(models.Model):
>>     title = models.CharField(max_length=50)
>>     photo = models.ImageField(upload_to="photos/")
>>     bookmarks = models.OneToOneField(Bookmark, primary_key=True)
>>
>> The forms.py file has the following code related to images:
>> class BookmarkSaveForm(forms.Form):
>>   photo = forms.ImageField(
>>     label='Upload screenshot',
>>     required=False
>> )
>>
>> I am not quite sure how to write views.py code for the saving the images
>> to the specified directories.  Any suggestions on how to get started
>> with this is appreciated.
>>
>> Thank you,
>> Tonu
>>     
> >
>   


-- 
Tonu Mikk
Educational Technology Consultant
Digital Media Center - dmc.umn.edu
tm...@umn.edu 612 625-9221


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to