Method 1: Override admin template
In django admin templates, there’s
{% block extrastyle %}{% endblock %}
and can add some styles to there.
Method 2: Add Media class to ModelAdmin
If you want to add css
or js
for only one ModelAdmin, you can add Media
class to ModelAdmin
class CustomModelAdmin(admin.ModelAdmin):
class Media:
js = ('js/admin/my_own_admin.js',)
css = {
'all': ('css/admin/my_own_admin.css',)
}
'backend > django' 카테고리의 다른 글
Django: custom list_filter in ModelAdmin (0) | 2018.04.29 |
---|---|
Django: filter queryset with m2m - using annotate (0) | 2018.04.28 |
Django: overriding 403 page (0) | 2018.04.26 |
Using Environment variable in uswgi.ini (0) | 2018.04.22 |
django-redis install and basic usage (0) | 2018.04.16 |