Esempio n. 1
0
 def handle(self, *args, **options):
     # Get projects
     if args:
         projects = [Project.objects.get(number=n) for n in args]
     else:
         projects = Project.objects.all()
     
     models = Index.searchable_models()
     
     n = 0
     for model in models:
         instances = model.objects.all()
         for instance in instances:
             if instance._project in projects:
                 new = Index._index(instance)
                 if new:
                     n += 1
     
     print "Indexed %d objects." % n