1 from django.core.management.base import AppCommand
2 from django.db import models
4 from djangosphinx.manager import SphinxModelManager
6 class Command(AppCommand):
7 help = "Prints generic configuration for any models which use a standard SphinxSearch manager."
9 output_transaction = True
11 def handle_app(self, app, **options):
12 from djangosphinx.utils.config import generate_config_for_model
13 model_classes = [getattr(app, n) for n in dir(app) if hasattr(getattr(app, n), '_meta')]
15 for model in model_classes:
16 indexes = getattr(model, '__sphinx_indexes__', [])
19 print generate_config_for_model(model, index)
21 print "Unable to find any models in application which use standard SphinxSearch configuration."
22 #return u'\n'.join(sql_create(app, self.style)).encode('utf-8')