]> git.parisson.com Git - telemeta.git/commitdiff
fix duplicate test collection
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 28 Jun 2016 10:29:53 +0000 (12:29 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 28 Jun 2016 10:29:53 +0000 (12:29 +0200)
telemeta/management/commands/telemeta-create-boilerplate.py

index e06eeca3329a86bdcfe2d6cf53a0373c7e24cb6b..cccb86fc37011602ca83fdfe966f65069e1daab0 100644 (file)
@@ -25,8 +25,13 @@ class Command(BaseCommand):
             result.delete()
 
     def handle(self, *args, **options):
-        collection, c = MediaCollection.objects.get_or_create(title=self.code,
-                            code=self.code, public_access = 'full')
+        collections = MediaCollection.objects.filter(code=self.code)
+        if collections:
+            collection = collection[0]
+        else:
+            collection = MediaCollection(title=self.code, code=self.code, public_access='full')
+            collection.save()
+            
         selection, c = Selection.objects.get_or_create(title='Tests')
 
         if c: