Skip to content
Dave Hall edited this page Dec 2, 2015 · 3 revisions

Integration with Django's built in admin interface

django-watson can be used to turbo charge your admin interface by bringing full text capabilities to the built-in search.

To add django-watson's powerful search to your admin site, simply register your models with a subclass of SearchAdmin.

from watson.admin import SearchAdmin

class YourModelAdmin(SearchAdmin):

    search_fields = ("title", "description",)  # A tuple of model fields to index.

admin.site.register(YourModel, YourModelAdmin)

You can also use SearchAdmin as a mixin with other specialized admin classes:

class YourModelAdmin(YourBaseModelAdmin, SearchAdmin):

    search_fields = ("title", "description",)

The admin integration maintains it's own set of search indexes, so it won't interfere with any models that you register for your frontend code.