Skip to content

Instantly share code, notes, and snippets.

@rg3915
Created August 30, 2019 16:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rg3915/26076942ef4b0564cfa4b398a92c9b51 to your computer and use it in GitHub Desktop.
Save rg3915/26076942ef4b0564cfa4b398a92c9b51 to your computer and use it in GitHub Desktop.
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

Thanks!

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