]> git.parisson.com Git - telemeta.git/commitdiff
Add domain arg for import
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 22 Nov 2016 16:26:07 +0000 (17:26 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 22 Nov 2016 16:26:07 +0000 (17:26 +0100)
telemeta/management/commands/telemeta-import-collections-from-crem.py

index 58745b847c94ecc56a7218ae730ccea524914333..1383ea0088eac5df6f60c560ae7413865b0c0c5d 100644 (file)
@@ -77,6 +77,9 @@ class Command(BaseCommand):
           make_option('-p', '--pattern',
             dest='pattern',
             help='define the pattern'),
+          make_option('-m', '--domain',
+            dest='domain',
+            help='define site domain'),
     )
 
     def write_file(self, item, media):
@@ -112,8 +115,16 @@ class Command(BaseCommand):
         self.source_dir = os.path.abspath(kwargs.get('source_dir'))
         self.dry_run =  kwargs.get('dry-run')
         self.force = kwargs.get('force')
+        self.domain = kwargs.get('domain')
+
+        site = Site.objects.all()[0]
+        if self.domain:
+            site.domain = self.domain
+            site.name = self.domain
+            site.save()
+        else:
+            self.domain = site.domain
 
-        self.domain = Site.objects.all()[0].domain
         self.user = User.objects.filter(username='admin')[0]
         self.collections = os.listdir(self.source_dir)