]> git.parisson.com Git - teleforma.git/commitdiff
Adapt copy script for 2017
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 23 Dec 2016 16:42:03 +0000 (17:42 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 23 Dec 2016 16:42:03 +0000 (17:42 +0100)
teleforma/management/commands/teleforma-copy-seminars.py

index cd4e0f55cd51858e3c67e5601a87e3f419190501..26444ef088f226a9bb90108df8fa99cf52ce51ad 100644 (file)
@@ -30,8 +30,11 @@ class Command(BaseCommand):
     help = """Copy some seminars and their content thanks to their expiry date year"""
     args = ['site_domain from_year to_year log_file']
     language_code = 'fr_FR'
-    more = ['deontologie_1', 'deontologie_2', 'commercial_2', 'Contrats_4', 'PAC_5']
+    # more = ['deontologie_1', 'deontologie_2', 'commercial_2', 'Contrats_4', 'PAC_5']
+    more = []
     site = Site.objects.get_current()
+    expiry_date = datetime.datetime(2016, 12, 31)
+    new_date = datetime.datetime(2017, 1, 1)
 
     def handle(self, *args, **kwargs):
         to_year = int(args[-2])
@@ -44,7 +47,7 @@ class Command(BaseCommand):
 
         to_period, c = Period.objects.get_or_create(name=str(to_year))
         from_period, c = Period.objects.get_or_create(name=str(from_year))
-        expiry_date = datetime.datetime(2015, 12, 31)
+        expiry_date = self.expiry_date
 
         for seminar in Seminar.objects.all():
             if seminar.expiry_date:
@@ -55,7 +58,7 @@ class Command(BaseCommand):
                     clone = seminar.clone()
                     clone.publish_date = seminar.publish_date.replace(year=to_year)
                     clone.expiry_date = seminar.expiry_date.replace(year=to_year)
-                    clone.date_forced = datetime.datetime(2016, 1, 1)
+                    clone.date_forced = self.new_date
                     clone.period = to_period
                     clone.status = 1
                     clone.quiz = seminar.quiz