I am using a 3rd party app in my django webapp.
But I want to customize the admin view for one of the models in the 3rd party app.
The customization is more than changing the change_list.html
template i.e. I will need to add code to talk to an external webservice etc.
However, I don't want to modify the 3rd party app. Instead I want to override it.
How I override the ModelAdmin
for a model that comes from a 3rd party app ?
This should get you started:
from django.contrib import admin
from thirdpartyapp.models import ThirdPartyModel
from thirdpartyapp.admin import ThirdPartyAdmin
class CustomThirdPartyAdmin(ThirdPartyAdmin):
pass
admin.site.unregister(ThirdPartyModel)
admin.site.register(ThirdPartyModel, CustomThirdPartyAdmin)
I use this often to customize the UserAdmin as shown in this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With