Now using django-reversion to audit changes to django objects.
authorBrandon King <kingb@caltech.edu>
Wed, 22 Apr 2009 19:00:00 +0000 (19:00 +0000)
committerBrandon King <kingb@caltech.edu>
Wed, 22 Apr 2009 19:00:00 +0000 (19:00 +0000)
README
samplebc/samples/admin.py
samplebc/samples/models.py
samplebc/settings.py

diff --git a/README b/README
index 5f97167b23e700d1437c4166180875cba1b1a2e7..1a73ad571ab9a65f7605bc0173a751b0ebd5e167 100644 (file)
--- a/README
+++ b/README
@@ -3,5 +3,6 @@ Authors:
  * Brandon W. King
 
 Debian Dependencies:
- * python-django >= 1.0.x
+ * python-django >= 1.0.2
+ * django-reversion == 1.1.1
  * python-json
index 9a5dae28dcd62216ea950faf1d4d417421e1c342..05fc92e55ff3f099b76dc695c5d29571cc5dad3b 100644 (file)
@@ -1,19 +1,20 @@
 from django.contrib import admin
 from samplebc.samples.models import Owner, Sample, Freezer, Container, SampleType
+from reversion.admin import VersionAdmin
 
-class OwnerAdmin(admin.ModelAdmin):
+class OwnerAdmin(VersionAdmin):
     pass
 
-class SampleAdmin(admin.ModelAdmin):
+class SampleAdmin(VersionAdmin):
     pass
 
-class FreezerAdmin(admin.ModelAdmin):
+class FreezerAdmin(VersionAdmin):
     pass
 
-class ContainerAdmin(admin.ModelAdmin):
+class ContainerAdmin(VersionAdmin):
     pass
 
-class SampleTypeAdmin(admin.ModelAdmin):
+class SampleTypeAdmin(VersionAdmin):
     pass
 
 
index 8d53407747fe380032bd63728307ef2b2e1caaa9..86ed323a2a6387d35657577186569cf60afd8f90 100644 (file)
@@ -1,14 +1,20 @@
 from django.db import models
+from django.db.models import signals
+from django.contrib.auth.models import User, Group
 
-# Create your models here.
+#AUDIT_TYPES = [('Create', 'Create'),
+#               ('Update', 'Update'),
+#               ('Delete', 'Delete')]
 
 EXP_TYPES = [('RNASeq', 'RNASeq'),
              ('ChIPSeq','ChIPSeq'),
              ('DeNovoSeq','DeNovoSeq'),
              ('MethylSeq','MethylSeq')]
+
 FREEZER_BUILDINGS = [('Kerckhoff', 'Kerckhoff')]
 
 
+
 class Owner(models.Model):
     name = models.CharField(max_length=32)
     
@@ -23,6 +29,8 @@ class Freezer(models.Model):
     loc_desc = models.CharField(max_length=256, blank=True, null=True)
     temperature = models.FloatField(help_text='Celsius')
     
+    notes = models.TextField(blank=True, null=True)
+    
     uuid = models.CharField(max_length=32, unique=True)
     
     def __unicode__(self):
@@ -31,7 +39,7 @@ class Freezer(models.Model):
     @models.permalink
     def get_absolute_url(self):
         return ('samplebc.samples.views.freezer_summary', [str(self.uuid)])
-    
+
     
 class SampleType(models.Model):
     name = models.CharField(max_length=256)
@@ -46,6 +54,8 @@ class Container(models.Model):
     max_items = models.IntegerField()
     freezer = models.ForeignKey(Freezer)
     
+    notes = models.TextField(blank=True, null=True)
+    
     uuid = models.CharField(max_length=32, unique=True)
     
     def __unicode__(self):
@@ -67,6 +77,9 @@ class Sample(models.Model):
     sampleid = models.CharField(max_length=64, unique=True)
     sample_type = models.ForeignKey(SampleType)
     owner = models.ForeignKey(Owner)
+    
+    description = models.TextField()
+    
     # Concentration in ng/ul
     concentration = models.FloatField(help_text='ng/ul', blank=True, null=True)
     volume = models.FloatField(help_text='ul', blank=True, null=True)
@@ -78,3 +91,4 @@ class Sample(models.Model):
     @models.permalink
     def get_absolute_url(self):
         return ('samplebc.samples.views.sample_summary', [str(self.sampleid)])
+
index 4aa9dad612da268ada28355716102d1755b70cc4..7569b8b5a0c78c1eddcf204ea2e384a7668a0d09 100644 (file)
@@ -81,6 +81,7 @@ INSTALLED_APPS = (
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.admin',
+    'reversion',
     'samplebc.samples',
     'samplebc.bcmagic'
 )