Skip to content

Instantly share code, notes, and snippets.

@rg3915
Created Aug 30, 2019
Embed
What would you like to do?
Custom CSS and JS on Django Admin
# https://riptutorial.com/django/example/5359/additional-css-styles-and-js-scripts-for-admin-page
@admin.register(Person)
class PersonAdmin(admin.ModelAdmin):
list_display = ('__str__',)
date_hierarchy = 'created'
search_fields = ('first_name', 'last_name', 'email')
list_filter = (
# 'uf',
('created', DateRangeFilter),
)
form = PersonForm
class Media:
css = {
'all': ('css/admin/style.css',)
}
js = ('js/admin/main.js',)
$(function () {
$('#searchbar').attr('placeholder', 'Search by name')
})
.field-first_name {
background-color: #e6f2ff;
}
@alexTitakoff
Copy link

alexTitakoff commented Aug 11, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment