1👍
✅
You can specify a custom form for admin using the form
attribute of ModelAdmin
.
So using the example from the docs linked below, that would look like;
from django import forms
from django.contrib import admin
from myapp.models import Person
class PersonForm(forms.ModelForm):
class Meta:
model = Person
exclude = ['name']
class PersonAdmin(admin.ModelAdmin):
exclude = ['age']
form = PersonForm
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.form
So in your admin.py
you’d need something like;
from .forms import EntryForm
class EntryAdmin(admin.ModelAdmin):
form = EntryForm
Source:stackexchange.com