I would like to include the username in my upload_to directory path for when a user uploads an image. Here is what I currently have --
#model
class Avatar(models.Model):
avatar = models.ImageField(upload_to='images/%s' %(USERNAME) )
user = models.ForeignKey(UserProfile)
#form
class ProfilePictureForm(ModelForm):
class Meta:
model = Avatar
fields = ('avatar',)
How would I get the USERNAME
in the model to be able to set the upload_to path?