+import logging
import urlparse
from django.db import models
from django.contrib.auth.models import User, UserManager
from htsworkflow.frontend import settings
from htsworkflow.frontend.reports.libinfopar import *
+
# Create your models here.
+logger = logging.getLogger(__name__)
class Antibody(models.Model):
antigene = models.CharField(max_length=500, db_index=True)
('2A', 'Ligation, PCR, gel, PCR'),
('Done', 'Completed'),
)
+ PROTOCOL_END_POINTS_DICT = dict(PROTOCOL_END_POINTS)
+
stopping_point = models.CharField(max_length=25, choices=PROTOCOL_END_POINTS, default='Done')
amplified_from_sample = models.ForeignKey('self', blank=True, null=True, related_name='amplified_into_sample')
return u'#%s: %s' % (self.id, self.library_name)
class Meta:
- verbose_name_plural = "libraries"
- #ordering = ["-creation_date"]
- ordering = ["-id"]
+ verbose_name_plural = "libraries"
+ #ordering = ["-creation_date"]
+ ordering = ["-id"]
def antibody_name(self):
str ='<a target=_self href="/admin/samples/antibody/'+self.antibody.id.__str__()+'/" title="'+self.antibody.__str__()+'">'+self.antibody.nickname+'</a>'
else:
return False
+ def stopping_point_name(self):
+ end_points = Library.PROTOCOL_END_POINTS_DICT
+ name = end_points.get(self.stopping_point, None)
+ if name is None:
+ name = "Lookup Error"
+ logger.error("protocol stopping point in database didn't match names in library model")
+ return name
+
+
def libtags(self):
affs = self.tags.all().order_by('tag_name')
ar = []