Skip to content
Advertisement

How to add placeholder for search field in admin.py

How can I add placeholder in django for a search field I am using in admin.py with Django3.1 as:

class MyAdmin(admin.ModelAdmin):
    list_display = ['community']
    search_fields = ['community']

Is there any way to do something like this?

class MyAdmin(admin.ModelAdmin):
    search_fields = ['community']
    search_input_placeholder = 'Please input community id'

Advertisement

Answer

With Django 4, you can now add a search_help_text.

More details in the doc here.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement