]> git.parisson.com Git - teleforma.git/commitdiff
Add script manual admin submission
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 24 Jan 2017 20:42:35 +0000 (21:42 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 24 Jan 2017 20:42:35 +0000 (21:42 +0100)
teleforma/exam/admin.py
teleforma/exam/models.py
teleforma/management/commands/teleforma-exam-submit-scripts-debug.py

index ea2109d716c37bc4ad0a8fbc66a721dd0b98c9ec..1c9f23c203f82b27e8c2017ae6c90b8fffb2c7c8 100644 (file)
@@ -37,6 +37,7 @@ class ScriptAdmin(admin.ModelAdmin):
     readonly_fields = ['date_added','uuid','box_uuid','sha1','mime_type']
     list_filter = ['period', 'course__title', 'session', 'type', 'status']
     list_display = ['title', 'author_name', 'file_size', 'status']
+    actions = ['submit',]
 
     def author_name(self, instance):
         return instance.author.username
@@ -50,9 +51,15 @@ class ScriptAdmin(admin.ModelAdmin):
         else:
             return '0'
 
+    def submit(self, request, queryset):
+        for script in queryset.all():
+            script.status = 2
+            script.submit()
+
+    submit.short_description = "Submit scripts"
+
 
 admin.site.register(Script, ScriptAdmin)
 admin.site.register(ScriptPage)
 admin.site.register(ScriptType)
 admin.site.register(Quota, QuotaAdmin)
-
index 59a0bae71237e5704e77182cd3e65d96ed7fb767..a919475f9f5e554124b4ac77d80869889323bf53 100644 (file)
@@ -409,9 +409,9 @@ class Script(BaseResource):
         if not self.status == 0 and self.file:
             if not self.box_uuid:
                 self.uuid_link()
-                self.box_upload()
-                if not self.corrector and self.t == 1:
-                    self.auto_set_corrector()
+            self.box_upload()
+            if not self.corrector and self.t == 1:
+                self.auto_set_corrector()
             else:
                 if not self.corrector:
                     self.auto_set_corrector()
index 3465aa9b3e51f8a21965b38f8691a73c38dac7eb..97971e6679b972653446577e26d887abb667d5f0 100644 (file)
@@ -29,7 +29,7 @@ class Logger:
 class Command(BaseCommand):
     help = "submit all script to Box View"
     args = "log_file"
-
+    
     def handle(self, *args, **options):
         translation.activate(settings.LANGUAGE_CODE)
         logger = Logger(args[0])
@@ -41,4 +41,3 @@ class Command(BaseCommand):
             logger.logger.info(str(script.id) + ' : ' + script.url)
             logger.logger.info(script.status)
             time.sleep(10)
-