Minor updates to inventory schema based on input from Lorian.
authorBrandon King <kingb@caltech.edu>
Fri, 5 Jun 2009 18:00:50 +0000 (18:00 +0000)
committerBrandon King <kingb@caltech.edu>
Fri, 5 Jun 2009 18:00:50 +0000 (18:00 +0000)
htsworkflow/frontend/inventory/admin.py
htsworkflow/frontend/inventory/models.py

index 70e12b8b016d264c467253b00caae9385c9f6409..4e171773943ead580342a8dc7fb9c14db569d281 100644 (file)
@@ -1,9 +1,12 @@
 from django.contrib import admin
 
-from htsworkflow.frontend.inventory.models import Item, ItemInfo, ItemType, Vendor, Location, LongTermStorage
+from htsworkflow.frontend.inventory.models import Item, ItemInfo, ItemType, Vendor, Location, LongTermStorage, ItemStatus
 
 class ItemAdmin(admin.ModelAdmin):
     list_display = ('uuid', 'barcode_id','item_type', 'item_info', 'location', 'force_use_uuid', 'creation_date')
+    list_filter = (
+        'item_type',
+    )
 
 class ItemInfoAdmin(admin.ModelAdmin):
     pass
@@ -20,9 +23,13 @@ class LocationAdmin(admin.ModelAdmin):
 class LongTermStorageAdmin(admin.ModelAdmin):
     pass
 
+class ItemStatusAdmin(admin.ModelAdmin):
+    pass
+
 admin.site.register(Item, ItemAdmin)
 admin.site.register(ItemInfo, ItemInfoAdmin)
 admin.site.register(ItemType, ItemTypeAdmin)
 admin.site.register(Vendor, VendorAdmin)
 admin.site.register(Location, LocationAdmin)
 admin.site.register(LongTermStorage, LongTermStorageAdmin)
+admin.site.register(ItemStatus, ItemStatusAdmin)
index 26781ee75e8ec1fc64931226c917c1a56c8a3145..8f54fc3abcc87a43739f34c0d1c40a487fd1a69a 100644 (file)
@@ -42,8 +42,11 @@ class Location(models.Model):
 pre_save.connect(_assign_uuid, sender=Location)
 
 class ItemInfo(models.Model):
-    model_id = models.CharField(max_length=256)
-    model_url = models.URLField(blank=True, null=True)
+    model_id = models.CharField(max_length=256, blank=True, null=True)
+    part_number = models.CharField(max_length=256, blank=True, null=True)
+    lot_number = models.CharField(max_length=256, blank=True, null=True)
+    
+    url = models.URLField(blank=True, null=True)
     
     qty_purchased = models.IntegerField(default=1)
     
@@ -51,8 +54,18 @@ class ItemInfo(models.Model):
     purchase_date = models.DateField(blank=True, null=True)
     warranty_months = models.IntegerField(blank=True, null=True)
     
+    notes = models.TextField(blank=True, null=True)
+    
     def __unicode__(self):
-        return u"%s: %s" % (self.model_id, self.purchase_date)
+        name = u''
+        if self.model_id:
+            name += u"model:%s " % (self.model_id)
+        if self.part_number:
+            name += u"part:%s " % (self.part_number)
+        if self.lot_number:
+            name += u"lot:%s " % (self.lot_number)
+            
+        return u"%s: %s" % (name, self.purchase_date)
 
 
 class ItemType(models.Model):
@@ -62,7 +75,13 @@ class ItemType(models.Model):
     
     def __unicode__(self):
         return u"%s" % (self.name)
+
+class ItemStatus(models.Model):
+    name = models.CharField(max_length=64, unique=True)
+    notes = models.TextField(blank=True, null=True)
     
+    def __unicode__(self):
+        return self.name
 
 class Item(models.Model):
     
@@ -80,6 +99,8 @@ class Item(models.Model):
     
     location = models.ForeignKey(Location)
     
+    status = models.ForeignKey(ItemStatus, blank=True, null=True)
+    
     creation_date = models.DateTimeField(auto_now_add=True)
     modified_date = models.DateTimeField(auto_now=True)