Adding ReagentLibrary & ReagentFlowcell tables in Inventory App.
authorBrandon King <kingb@caltech.edu>
Sat, 11 Jul 2009 00:03:01 +0000 (00:03 +0000)
committerBrandon King <kingb@caltech.edu>
Sat, 11 Jul 2009 00:03:01 +0000 (00:03 +0000)
htsworkflow/frontend/inventory/admin.py
htsworkflow/frontend/inventory/models.py

index 4e171773943ead580342a8dc7fb9c14db569d281..7d9d537d356b6a2c1327d57576e4e6aa40a29cb0 100644 (file)
@@ -1,6 +1,6 @@
 from django.contrib import admin
 
-from htsworkflow.frontend.inventory.models import Item, ItemInfo, ItemType, Vendor, Location, LongTermStorage, ItemStatus
+from htsworkflow.frontend.inventory.models import Item, ItemInfo, ItemType, Vendor, Location, LongTermStorage, ItemStatus, ReagentFlowcell, ReagentLibrary
 
 class ItemAdmin(admin.ModelAdmin):
     list_display = ('uuid', 'barcode_id','item_type', 'item_info', 'location', 'force_use_uuid', 'creation_date')
@@ -26,6 +26,12 @@ class LongTermStorageAdmin(admin.ModelAdmin):
 class ItemStatusAdmin(admin.ModelAdmin):
     pass
 
+class ReagentFlowcellAdmin(admin.ModelAdmin):
+    pass
+
+class ReagentLibraryAdmin(admin.ModelAdmin):
+    pass
+
 admin.site.register(Item, ItemAdmin)
 admin.site.register(ItemInfo, ItemInfoAdmin)
 admin.site.register(ItemType, ItemTypeAdmin)
@@ -33,3 +39,6 @@ admin.site.register(Vendor, VendorAdmin)
 admin.site.register(Location, LocationAdmin)
 admin.site.register(LongTermStorage, LongTermStorageAdmin)
 admin.site.register(ItemStatus, ItemStatusAdmin)
+admin.site.register(ReagentFlowcell, ReagentFlowcellAdmin)
+admin.site.register(ReagentLibrary, ReagentLibraryAdmin)
+
index e98bd5ef77b3d718a57ab0bcd3e9086044f127b3..456db7ce6dbeb7b1de667e6113e387746b9e9c9b 100644 (file)
@@ -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() ]))