Save new object before attaching to a collection
authorDiane Trout <diane@ghic.org>
Thu, 2 Jun 2016 20:44:27 +0000 (13:44 -0700)
committerDiane Trout <diane@ghic.org>
Fri, 24 Jun 2016 22:55:58 +0000 (15:55 -0700)
Django tests were throwing warning about the newfile object not being
saved when I added it to the datafile_set collection.

experiments/models.py

index 4a42caae4ba8021d124648c75bd25bedd5893f2b..b7fc5b87beced4598f3bafd2cfa6e0cfb4daa42a 100644 (file)
@@ -351,6 +351,7 @@ class SequencingRun(models.Model):
                             lane_number=lane_number)
                         newfile.library = lane.library
 
+                    newfile.save()
                     self.datafile_set.add(newfile)
 
         self.last_update_time = timezone.now()