I need help on selecting a default profile picture depending on the gender of the user.. I have three default images in my media folder that i want to use as defaults, namely "00.png, 01.png, and 02.png".
models.py
GenderChoice = (
('others', 'Others'),
('male', 'Male'),
('female' :'Female')
)
class User(AbstractBaseUser):
gender = models.CharField(choice=GenderChoice)
pro_pic = models.ImageField(upload_to ="", default ="00.png")
what I want is if a user selects gender="others" then 00.png should be saved as default and if they select male the 01.png should be selected as default..
Please helpđđđ
Aucun commentaire:
Enregistrer un commentaire