Преглед на файлове

[search] Update examples to Document2

Romain Rigaux преди 11 години
родител
ревизия
148213b6cb
променени са 2 файла, в които са добавени 7 реда и са изтрити 41 реда
  1. 0 35
      apps/search/src/search/fixtures/initial_search_examples.json
  2. 7 6
      apps/search/src/search/management/commands/search_setup.py

Файловите разлики са ограничени, защото са твърде много
+ 0 - 35
apps/search/src/search/fixtures/initial_search_examples.json


+ 7 - 6
apps/search/src/search/management/commands/search_setup.py

@@ -20,17 +20,18 @@ import logging
 from django.core import management
 from django.core.management.base import NoArgsCommand
 
-from desktop.models import Document
+from desktop.models import Document, Document2, SAMPLE_USERNAME
 from useradmin.models import install_sample_user
 
+
 LOG = logging.getLogger(__name__)
 
-# initial_search_examples.json: add 1000000 to the ids
 
 class Command(NoArgsCommand):
   def handle_noargs(self, **options):
 
-    # Load jobs
-#    install_sample_user()
-    management.call_command('loaddata', 'initial_search_examples.json', verbosity=2)
-    Document.objects.sync()
+    if not Document2.objects.filter(owner__username=SAMPLE_USERNAME).exists():
+      install_sample_user()
+
+      management.call_command('loaddata', 'initial_search_examples.json', verbosity=2)
+      Document.objects.sync()

Някои файлове не бяха показани, защото твърде много файлове са промени