Hi,
in my application, i want to enable the users to upload pics.
These pictures are thus linked to the user.
I want to reflect that on a filesystem bases by saving the pics
in a directory that also has the authenticated user.
Getting the authenticated user isn't a problem, customizing the path is.
In my model i have this code:
IMAGE_PATH = "img/_USER_/icons/"
class Icon(models.Model):
...
image = models.ImageField(upload_to=IMAGE_PATH, blank=True,
help_text="Maximum 100px by 100px, 50 kb")
...
def save(self):
self.user = threadlocals.get_current_user()
if ( self.image ):
self.image = self.image.replace("_USER_",str(self.user))
However this doesn't change the image path and it's still saved in
img/_USR_/icons/ instead of img/<username>/icons.
This is confirmed by self.get_image_url()
How can i get the _USER_ replaced by the username?
Thanks,
Benedict
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---