Custom CSS and JS on Django Admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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',) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
$('#searchbar').attr('placeholder', 'Search by name') | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.field-first_name { | |
background-color: #e6f2ff; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!