src/ldtplatform/management/commands/importweb.py
changeset 342 c67af29cd199
parent 341 6429b9a65264
child 345 63af78d78387
equal deleted inserted replaced
341:6429b9a65264 342:c67af29cd199
    48 
    48 
    49 class Command(BaseCommand):
    49 class Command(BaseCommand):
    50     '''
    50     '''
    51     command
    51     command
    52     '''
    52     '''
       
    53     def __init__(self, *args, **kwargs):
       
    54         super(Command, self).__init__(*args, **kwargs)
       
    55         self.parser = None
       
    56         self.myfile = None
       
    57         self.writefile = None
       
    58         self.durations = None
       
    59 
    53     def add_arguments(self, parser):
    60     def add_arguments(self, parser):
    54         '''
    61         '''
    55         add arguments
    62         add arguments
    56         '''
    63         '''
    57 
    64 
   167                 myfrontproj = models.Project.objects.get(title='front project : %s' % title)
   174                 myfrontproj = models.Project.objects.get(title='front project : %s' % title)
   168                 myfrontproj.ldt = self.change_annotations(ldtproject, myfrontproj.ldt)
   175                 myfrontproj.ldt = self.change_annotations(ldtproject, myfrontproj.ldt)
   169                 myfrontproj.save()
   176                 myfrontproj.save()
   170                 self.stdout.write("%s done"%title)
   177                 self.stdout.write("%s done"%title)
   171                 self.writefile.writerow([mysource,
   178                 self.writefile.writerow([mysource,
   172                                         models.Content.objects.get(title=title).iri_id,
   179                                          models.Content.objects.get(title=title).iri_id,
   173                                         title.encode('utf-8') if title else '',
   180                                          title.encode('utf-8') if title else '',
   174                                         myfrontproj.ldt_id,
   181                                          myfrontproj.ldt_id,
   175                                     ])
   182                                         ])
   176         csvfile.close()
   183         csvfile.close()
   177         csvfile2.close()
   184         csvfile2.close()