From: Brandon King Date: Wed, 14 May 2008 00:01:27 +0000 (+0000) Subject: v0.2.0 progress X-Git-Tag: stanford.caltech-merged-database-2009-jan-15~63 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=1aa3d8e9730c7c2db67564d771e592fb84feecad v0.2.0 progress * Commented out eland_result table as it is not being used by either site and Stanford has implemented something that is probably more useful, so we will like import that. * Person has been renamed to UserProfile and has been intergrated with the user profiles feature of Django (http://www.djangobook.com/en/1.0/chapter12/#cn222), which allows you to get access to the "profile" information by using user.get_profile(). * Added Lab which just contains a name... This will be used to implement user/lab level access to Flowcell/Library information. --- diff --git a/gaworkflow/frontend/fctracker/models.py b/gaworkflow/frontend/fctracker/models.py index dae892a..02407e2 100644 --- a/gaworkflow/frontend/fctracker/models.py +++ b/gaworkflow/frontend/fctracker/models.py @@ -1,4 +1,5 @@ from django.db import models +from django.contrib.auth.models import User from gaworkflow.frontend import settings # Create your models here. @@ -23,25 +24,39 @@ class Species(models.Model): }), ) -class Person(models.Model): +class Lab(models.Model): + + name = models.CharField(max_length=100, blank=False, unique=True) + + def __str__(self): + return self.name + + class Admin: + pass + +class UserProfile(models.Model): + + # This allows you to use user.get_profile() to get this object + user = models.ForeignKey(User, unique=True) - name = models.CharField(max_length=100, primary_key=True, db_index=True) - lab = models.CharField(max_length=100) - email = models.CharField(max_length=50, blank=True, null=True) + lab = models.ForeignKey(Lab) + #email = models.CharField(max_length=50, blank=True, null=True) def __str__(self): - return '%s (%s lab)' % (self.name, self.lab) + return '%s (%s lab)' % (self.user, self.lab) class Meta: - verbose_name_plural = "people" - ordering = ["lab"] + #verbose_name_plural = "people" + #ordering = ["lab"] + pass class Admin: - fields = ( - (None, { - 'fields': (('name', 'lab'), ('email')) - }), - ) + #fields = ( + # (None, { + # 'fields': (('email', 'lab'), ('email')) + # }), + #) + pass class Library(models.Model): @@ -54,7 +69,7 @@ class Library(models.Model): made_by = models.CharField(max_length=50, blank=True, default="Lorian") creation_date = models.DateField(blank=True, null=True) - made_for = models.ForeignKey(Person) + made_for = models.ForeignKey(User) PROTOCOL_END_POINTS = ( ('?', 'Unknown'), @@ -191,13 +206,14 @@ class FlowCell(models.Model): }), ) -class ElandResult(models.Model): - - class Admin: pass - - flow_cell = models.ForeignKey(FlowCell) - config_file = models.FileField(upload_to=settings.UPLOADTO_CONFIG_FILE) - eland_result_pack = models.FileField(upload_to=settings.UPLOADTO_ELAND_RESULT_PACKS) - bed_file_pack = models.FileField(upload_to=settings.UPLOADTO_BED_PACKS) - - notes = models.TextField(blank=True) +# Did not finish implementing, removing to avoid further confusion. +#class ElandResult(models.Model): +# +# class Admin: pass +# +# flow_cell = models.ForeignKey(FlowCell) +# config_file = models.FileField(upload_to=settings.UPLOADTO_CONFIG_FILE) +# eland_result_pack = models.FileField(upload_to=settings.UPLOADTO_ELAND_RESULT_PACKS) +# bed_file_pack = models.FileField(upload_to=settings.UPLOADTO_BED_PACKS) +# +# notes = models.TextField(blank=True)