问题
I made a ModelForm from a Model in Django, the model have an ImageField field on it. When I render the info of the form in a template for editing it, it show this:

How I can remove the 'Currently' tag and link??
回答1:
The Django Admin uses AdminFileWidget
to render ImageFields. AdminFileWidget
merely inherits from the standard FileInput
widget and adds the extra "Currently" stuff. So just use FileInput
instead:
from django.db import models
from django import forms
class MyModelAdmin(admin.ModelAdmin):
formfield_overrides = {
models.ImageField: {'widget': forms.FileInput },
}
来源:https://stackoverflow.com/questions/6076154/how-to-remove-the-currently-tag-and-link-of-a-fileinput-widget-in-django