I'm trying to make an "avatar" field in my user model (tried using all libraries out there, didnt quite like them)
class UserProfile(models.Model):
user = models.OneToOneField(User, related_name='profile')
...
pic = models.ImageField(upload_to="photos", default='pic')
in setting.py
MEDIA_ROOT = '/media/'
Also I'm not even using a form but uploading directly from the admin, the problem is that the image does not save into the folder templates/media/photos.
Also I dont have any view associated, just trying the image to save into the folder so I can understand better how the file system works.
edit: misspelled
Aucun commentaire:
Enregistrer un commentaire