Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the "Currently" tag and link of a FileInput widget in Django?

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:

Screenshot that show Currently info

How I can remove the 'Currently' tag and link??

like image 673
segaco Avatar asked May 20 '11 18:05

segaco


1 Answers

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 },
    }
like image 142
Chris Pratt Avatar answered Sep 29 '22 09:09

Chris Pratt