Skip to content

Commit

Permalink
🎨 Remove reverse relationship from Source to biorecord (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyosun authored Sep 9, 2024
1 parent dc8f09e commit ae5933e
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Generated by Django 5.2 on 2024-09-09 11:43

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("bionty", "0038_alter_artifactcellline_created_by_and_more"),
]

operations = [
migrations.AlterField(
model_name="cellline",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="cellmarker",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="celltype",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="developmentalstage",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="disease",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="ethnicity",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="experimentalfactor",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="gene",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="organism",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="pathway",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="phenotype",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="protein",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
migrations.AlterField(
model_name="tissue",
name="source",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="bionty.source",
),
),
]
2 changes: 1 addition & 1 deletion bionty/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class BioRecord(Record, HasParents, CanValidate):
class Meta:
abstract = True

source = models.ForeignKey(Source, PROTECT, null=True)
source = models.ForeignKey(Source, PROTECT, null=True, related_name="+")
""":class:`~bionty.Source` this record associates with."""

def __init__(self, *args, **kwargs):
Expand Down
4 changes: 1 addition & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ def lint(session: nox.Session) -> None:
@nox.session
@nox.parametrize("group", ["bionty-unit", "bionty-docs"])
def build(session: nox.Session, group: str):
branch = (
"improvedocsallregistries" if IS_PR else "release"
) # point back to "release"
branch = "main" if IS_PR else "release" # point back to "release"
install_lamindb(session, branch=branch)
session.run(*"uv pip install --system -e .[dev]".split())

Expand Down

0 comments on commit ae5933e

Please sign in to comment.