List all registred models (management command)

Exposed the ``watson.get_registered_models()`` function as management command for debugging purpose.
This commit is contained in:
Philippe O. Wagner 2015-03-17 10:57:43 +01:00
parent de5fcb3064
commit 91d3f2040e

View file

@ -0,0 +1,16 @@
"""Exposed the watson.get_registered_models() function as management command for debugging purpose. """
from django.core.management.base import NoArgsCommand
import watson
class Command(NoArgsCommand):
help = "List all registed models by django-watson."
def handle_noargs(self, **options):
"""Runs the management command."""
self.stdout.write("The following models are registed for the django-watson seach engine:\n")
for mdl in watson.get_registered_models():
self.stdout.write("- %s\n" % mdl.__name__)