[Fixed]-How to give admin ability to change media path using frontend in django?

1👍

Hope If this Works

def custom_upload_function(obj, f_name):
    "here u may get path from admin or from some where stored in to database , and replace /media/ with admin path"
         return os.path.join('/media/%s/' % obj.id, f_name)

def AbcModel(models.Model):
        profileImage= models.ImageField(upload_to=custom_upload_function, max_length=255, blank=True, null=True)
👤Rahil

Leave a comment