7👍
✅
You should create a ModelForm for this model, and add the field there. It could look like this:
from django import forms
from models import MyModel
class MyModelForm(forms.ModelForm):
extra_file = forms.FileField()
class Meta:
model = MyModel
Then, you can make the ModelAdmin to use this form. If you saved MyModelForm in yourapp/forms.py, your ModelAdmin would look like this:
from django.contrib import admin
from models import MyModel
from forms import MyModelForm
class MyModelAdmin(admin.ModelAdmin):
form = MyModelForm
admin.site.register(MyModel, MyModelAdmin)
👤jpic
Source:stackexchange.com