diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py index 5e4c3d225e8da27831ddd30b070c7103291ec8f8..0dbfdb635505f4a921f9381e058e9813d7033d56 100644 --- a/ippisite/ippidb/models.py +++ b/ippisite/ippidb/models.py @@ -104,7 +104,7 @@ class Protein(AutoFillableModel): short_name = models.CharField('Short name', max_length=50) gene_name = models.CharField('Gene name', unique=True, max_length=30) entry_name = models.CharField('Entry name', max_length=30) - organism = models.ForeignKey('Taxonomy', default='Homo sapiens') + organism = models.ForeignKey('Taxonomy', models.CASCADE) molecular_functions = models.ManyToManyField(MolecularFunction) def autofill(self): @@ -152,8 +152,8 @@ class Domain(AutoFillableModel): class ProteinDomainComplex(models.Model): - protein = models.ForeignKey('Protein') - domain = models.ForeignKey('Domain') + protein = models.ForeignKey('Protein', models.CASCADE) + domain = models.ForeignKey('Domain', models.CASCADE) ppc_copy_nb = models.IntegerField( 'Number of copies of the protein in the complex') @@ -201,7 +201,7 @@ class Ppi(models.Model): pdb_id = models.CharField('PDB ID', max_length=4, null=True) pockets_nb = models.IntegerField( 'Total number of pockets in the complex', default=1) - symmetry = models.ForeignKey(Symmetry) + symmetry = models.ForeignKey(Symmetry, models.CASCADE) diseases = models.ManyToManyField(Disease) def __str__(self): @@ -233,8 +233,8 @@ class Ppi(models.Model): return name class PpiComplex(models.Model): - ppi = models.ForeignKey(Ppi) - complex = models.ForeignKey(ProteinDomainComplex) + ppi = models.ForeignKey(Ppi, models.CASCADE) + complex = models.ForeignKey(ProteinDomainComplex, models.CASCADE) cc_nb = models.IntegerField( 'Number of copies of the complex in the PPI', default=1) @@ -318,7 +318,7 @@ class Compound(models.Model): iupac_name = models.CharField( 'IUPAC name', max_length=255, blank=True, null=True) mddr_compound = models.ForeignKey( - 'MDDRCompoundImport', blank=True, null=True) + 'MDDRCompoundImport', models.CASCADE, blank=True, null=True) @property def biblio_refs(self): @@ -407,15 +407,15 @@ class TestActivityDescription(models.Model): ('I', 'Inhibition'), ('S', 'Stabilization') ) - biblio = models.ForeignKey(Bibliography) - ppi = models.ForeignKey(Ppi, blank=True, null=True) + biblio = models.ForeignKey(Bibliography, models.CASCADE) + ppi = models.ForeignKey(Ppi, models.CASCADE, blank=True, null=True) test_name = models.CharField('Test name', max_length=100) test_type = models.CharField('Test type', max_length=5, choices=TEST_TYPES) test_modulation_type = models.CharField( 'Test modulation type', max_length=1, choices=TEST_MODULATION_TYPES) nb_active_compounds = models.IntegerField( 'Total number of active compounds') - cell_line = models.ForeignKey(CellLine, blank=True, null=True) + cell_line = models.ForeignKey(CellLine, models.CASCADE, blank=True, null=True) def get_complexes(self): """ @@ -440,8 +440,8 @@ class CompoundActivityResult(models.Model): ('pKd', 'pKd (dissociation constant, -log10)'), ('pKi', 'pKi (inhibition constant, -log10)'), ) - compound = models.ForeignKey(Compound) - test_activity_description = models.ForeignKey(TestActivityDescription) + compound = models.ForeignKey(Compound, models.CASCADE) + test_activity_description = models.ForeignKey(TestActivityDescription, models.CASCADE) activity_type = models.CharField( 'Activity type', max_length=5, choices=ACTIVITY_TYPES) activity = models.DecimalField( @@ -455,16 +455,16 @@ class CompoundActivityResult(models.Model): class TestCytotoxDescription(models.Model): - biblio = models.ForeignKey(Bibliography) + biblio = models.ForeignKey(Bibliography, models.CASCADE) test_name = models.CharField('Cytotoxicity test name', max_length=100) - cell_line = models.ForeignKey(CellLine) + cell_line = models.ForeignKey(CellLine, models.CASCADE) compound_concentration = models.DecimalField( 'Compound concentration in μM', max_digits=7, decimal_places=3, blank=True, null=True) class CompoundCytotoxicityResult(models.Model): - compound = models.ForeignKey(Compound) - test_cytotoxicity_description = models.ForeignKey(TestCytotoxDescription) + compound = models.ForeignKey(Compound, models.CASCADE) + test_cytotoxicity_description = models.ForeignKey(TestCytotoxDescription, models.CASCADE) toxicity = models.BooleanField('Toxicity', default=False) class Meta: @@ -478,9 +478,9 @@ class TestPKDescription(models.Model): ('IP', ''), ('SL', 'SL') ) - biblio = models.ForeignKey(Bibliography) + biblio = models.ForeignKey(Bibliography, models.CASCADE) test_name = models.CharField('Pharmacokinetic test name', max_length=100) - organism = models.ForeignKey(Taxonomy) + organism = models.ForeignKey(Taxonomy, models.CASCADE) administration_mode = models.CharField( 'Administration mode', max_length=2, choices=ADMINISTRATION_MODES, blank=True, null=True) dose = models.DecimalField( @@ -490,8 +490,8 @@ class TestPKDescription(models.Model): class CompoundPKResult(models.Model): - compound = models.ForeignKey(Compound) - test_pk_description = models.ForeignKey(TestPKDescription) + compound = models.ForeignKey(Compound, models.CASCADE) + test_pk_description = models.ForeignKey(TestPKDescription, models.CASCADE) tolerated = models.NullBooleanField('Tolerated', null=True) auc = models.IntegerField( 'Area under curve (ng.mL-1.hr)', blank=True, null=True) @@ -516,10 +516,10 @@ class CompoundAction(models.Model): ('A', 'Allosteric'), ('U', 'Unspecified') ) - compound = models.ForeignKey(Compound) + compound = models.ForeignKey(Compound, models.CASCADE) activation_mode = models.CharField( 'Activation mode', max_length=1, choices=ACTIVATION_MODES) - ppi = models.ForeignKey(Ppi) + ppi = models.ForeignKey(Ppi, models.CASCADE) pdb_id = models.CharField('PDB ID', max_length=4, blank=True, null=True) nb_copy_compounds = models.IntegerField( 'Number of copies for the compound') @@ -536,8 +536,8 @@ class CompoundAction(models.Model): class RefCompoundBiblio(models.Model): - compound = models.ForeignKey(Compound) - bibliography = models.ForeignKey(Bibliography) + compound = models.ForeignKey(Compound, models.CASCADE) + bibliography = models.ForeignKey(Bibliography, models.CASCADE) compound_name = models.CharField( 'Compound name in the publication', max_length=50)