Commit a36ea5a6 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

make sure PPI name is never empty so the query filter is ok

this addresses #219
the filter wasn't working properly if PPIs were defined with name
fields set to None. This modification does two things:
- run a "custom" migration script to force compute all PPI names
- change the PPI model to make the name a non-nullable field
parent deff1170
# Generated by Django 2.2.1 on 2020-04-28 17:17
from django.db import migrations, models
import django.db.models.deletion
from ippidb.models import Ppi
def run_generate_protein_domain_complex_groups(apps, schema_editor):
for ppi in Ppi.objects.all():
ppi.compute_name_from_protein_names()
ppi.save()
class Migration(migrations.Migration):
dependencies = [
('ippidb', '0055_fill_proteindomaincomplexgroups'),
]
operations = [
migrations.RunPython(run_generate_protein_domain_complex_groups,reverse_code=migrations.RunPython.noop),
]
# Generated by Django 2.2.1 on 2020-04-30 07:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ippidb', '0056_fill_ppiname'),
]
operations = [
migrations.AlterField(
model_name='ppi',
name='name',
field=models.TextField(default='', verbose_name='PPI name'),
preserve_default=False,
),
]
......@@ -474,7 +474,7 @@ class Ppi(AutoFillableModel):
symmetry = models.ForeignKey(Symmetry, models.CASCADE)
diseases = models.ManyToManyField(Disease, blank=True)
family = models.ForeignKey(PpiFamily, models.CASCADE, null=True, blank=True)
name = models.TextField("PPI name", null=True, blank=True)
name = models.TextField("PPI name")
def __str__(self):
return "PPI #{} on {}".format(self.id, self.name)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment