From: Diane Trout Date: Fri, 23 Jan 2009 02:21:09 +0000 (+0000) Subject: Add id as an AutoNumber(primary_key=True) field and remove the pk from X-Git-Tag: 0.2.0.1~34 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=8ce9a653d84ff1f24ecd4950479ba01da64125e6 Add id as an AutoNumber(primary_key=True) field and remove the pk from library_id. Stanford decided to use library_id as a text field so they could use library IDs like "SL100". Caltech just used the raw sql id, so the foreign key reference in experiments_flowcells was expecting a numeric id, but since the model had the text field as the primary key things didn't work. --- diff --git a/htsworkflow/frontend/samples/models.py b/htsworkflow/frontend/samples/models.py index 34cf260..16ef011 100644 --- a/htsworkflow/frontend/samples/models.py +++ b/htsworkflow/frontend/samples/models.py @@ -107,8 +107,8 @@ class Affiliation(models.Model): unique_together = (("name", "contact"),) class Library(models.Model): - - library_id = models.CharField(max_length=30, primary_key=True, db_index=True) + id = models.AutoField(primary_key=True) + library_id = models.CharField(max_length=30, db_index=True) library_name = models.CharField(max_length=100, unique=True) library_species = models.ForeignKey(Species) cell_line = models.ForeignKey(Cellline) @@ -135,7 +135,6 @@ class Library(models.Model): default='RNA-seq') creation_date = models.DateField(blank=True, null=True) - # made_for = models.ForeignKey(User) made_for = models.CharField(max_length=50, blank=True, verbose_name='ChIP/DNA/RNA Made By') made_by = models.CharField(max_length=50, blank=True, default="Lorian")