i have a Model for a user profile in my django app that has a models.ImageField and i have an ModelAdmin for it
when a user uploads an image , in the admin page , when i go in that user’s Customize page , in the ImageField section , there is the url of uploaded image and a checkbox named “Clear” and a button for updating the image. how can i change the text of that checkbox ? for example i want it to have the text “Delete” instead of “Clear”
i have a Model for a user profile in my django app that has
Share
It seems like “Clear” is hardcode.
So either you create a custom widget simply like that:
And assign it to your form field like that
Or add overwrite it in your admin
Or you use the translation mechanisms to translate Clear into Delete. Django translation is described in the docs pretty well.
I personally, just think that it is quite some overhead for your problem, unless you are using translations anyway. I would clearly recommend the custom widget – the addtional code is really minimal.