X-Git-Url: http://woldlab.caltech.edu/gitweb/?a=blobdiff_plain;f=htsworkflow%2Ffrontend%2Finventory%2Fmodels.py;h=456db7ce6dbeb7b1de667e6113e387746b9e9c9b;hb=753584c653403e158bf3b830ef1f1489adb61148;hp=e98bd5ef77b3d718a57ab0bcd3e9086044f127b3;hpb=c95fac3ce826ae5b5fe6b8797d76c45307b12a4b;p=htsworkflow.git diff --git a/htsworkflow/frontend/inventory/models.py b/htsworkflow/frontend/inventory/models.py index e98bd5e..456db7c 100644 --- a/htsworkflow/frontend/inventory/models.py +++ b/htsworkflow/frontend/inventory/models.py @@ -138,4 +138,35 @@ class LongTermStorage(models.Model): def __unicode__(self): return u"%s: %s" % (str(self.flowcell), ', '.join([ str(s) for s in self.storage_devices.iterator() ])) + + +class ReagentBase(models.Model): + + reagent = models.ManyToManyField(Item) + + creation_date = models.DateTimeField(auto_now_add=True) + modified_date = models.DateTimeField(auto_now=True) + + class Meta: + abstract = True + + +class ReagentFlowcell(ReagentBase): + """ + Links reagents and flowcells + """ + flowcell = models.ForeignKey(FlowCell) + + def __unicode__(self): + return u"%s: %s" % (str(self.flowcell), ', '.join([ str(s) for s in self.reagent.iterator() ])) + + +class ReagentLibrary(ReagentBase): + """ + Links libraries and flowcells + """ + library = models.ForeignKey(Library) + + def __unicode__(self): + return u"%s: %s" % (str(self.library), ', '.join([ str(s) for s in self.reagent.iterator() ]))