コード例 #1
0
ファイル: index.py プロジェクト: myrlund/Issues
 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
コード例 #2
0
ファイル: forms.py プロジェクト: myrlund/Issues
def initial_types():
    return [ContentType.objects.get_for_model(m).id for m in Index.searchable_models()]