コード例 #1
0
 def handle(self, *args, **options):
     translation.activate(settings.LANGUAGE_CODE)
     if options['all']:
         delete_index_es()
         create_index_es()
         for video in VIDEOS:
             index_es(video)
     elif options['video_id']:
         for video_id in options['video_id']:
             self.manage_es(video_id)
     else:
         self.stdout.write(
             self.style.ERROR(
                 "****** Warning: you must give some arguments: %s ******" %
                 self.args))
     translation.deactivate()
コード例 #2
0
ファイル: index_videos.py プロジェクト: val260/podv2
 def handle(self, *args, **options):
     translation.activate(settings.LANGUAGE_CODE)
     if options["all"]:
         delete_index_es()
         time.sleep(10)
         create_index_es()
         time.sleep(10)
         iteration = 0
         for video in VIDEOS:
             if iteration % 1000 == 0:
                 time.sleep(10)
             iteration += 1
             index_es(video)
     elif options["video_id"]:
         for video_id in options["video_id"]:
             self.manage_es(video_id)
     else:
         self.stdout.write(
             self.style.ERROR(
                 "****** Warning: you must give some arguments: %s ******" %
                 self.args))
     translation.deactivate()
コード例 #3
0
 def handle(self, *args, **options):
     delete_index_es()
     create_index_es()
     self.stdout.write(
         self.style.SUCCESS('Successfully create index Video'))