I defined such a model:

class Thing(models.Model):
    photo = models.ImageField(
        upload_to='images/', blank=True, null=True)

Here is the form for this model:
class ThingForm(ModelForm):
    class Meta:
        model = Thing

Now it could handle the image upload request and save images to
MEDIA_ROOT/images/ directory.

My question is how to change the upload_to value dynamicly in the
view. For example, I can get the user name in the view level, and I
want to save the image to that user's directory, e.g. 'avatar/
username/'.

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