django-1.11

ImageField / FileField Django form Currently unable to trim the path to filename

北慕城南 提交于 2019-12-02 13:48:23
问题 I have a ImageField that stores in AWS S3 (similar to FileField). In the form, it has this "Currently" label that shows the image file path. I would like to trim and just show the filename. referring to the latest answer in Django : customizing FileField value while editing a model, I still cant get it to work. It shows "Currently" with the file path name like this: https://imgur.com/a/xkUZi form.py class CustomClearableFileInput(ClearableFileInput): def get_template_substitution_values(self,

ImageField / FileField Django form Currently unable to trim the path to filename

对着背影说爱祢 提交于 2019-12-02 04:05:12
I have a ImageField that stores in AWS S3 (similar to FileField). In the form, it has this "Currently" label that shows the image file path. I would like to trim and just show the filename. referring to the latest answer in Django : customizing FileField value while editing a model , I still cant get it to work. It shows "Currently" with the file path name like this: https://imgur.com/a/xkUZi form.py class CustomClearableFileInput(ClearableFileInput): def get_template_substitution_values(self, value): """ Return value-related substitutions. """ logging.debug("CustomClearableFileInput %s",value