I have a model called Offer containing, besides other fields, a
picture field as in the following example:

class Offer(models.Model):
    picture = models.ImageField(null=True, blank=False, unique=False,
upload_to='offers/')

I created a form for adding Offer objects as follows:

class AddOfferForm(forms.Form):
    picture = forms.CharField(widget=forms.FileInput())

Now it happens that when I add an offer object using the admin
interface the picture gets stored in the subdirectory of MEDIA_ROOT
called "offer" (as specified in the field "upload_to").
When I add an offer object using the form I created there are two
problems:
1. the picture doesn't get stored in the in any directory (it simply
remains in the original directory)
2. the relative path to the picture doesn't include the subdirectory
"offers" as if the picture was stored in the MEDIA_ROOT folder.

I guess I'm missing something (maybe in the form or in the view) but
I wasn't able to find it (neither in the documentation nor in this
group).

Any suggestion would be very appreciated.

Thanks
Francesco


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