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
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)
-
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()
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])
logger.logger.info(str(script.id) + ' : ' + script.url)
logger.logger.info(script.status)
time.sleep(10)
-