diff --git a/rcr/migrations/0020_item_radiology_categories.py b/rcr/migrations/0020_item_radiology_categories.py new file mode 100644 index 00000000..3a75b8ff --- /dev/null +++ b/rcr/migrations/0020_item_radiology_categories.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.2 on 2024-02-26 11:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('rcr', '0019_alter_item_oncology_category_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='item', + name='radiology_categories', + field=models.ManyToManyField(blank=True, related_name='items_radiology', to='rcr.radiologycategory'), + ), + ] diff --git a/rcr/migrations/0021_auto_20240226_1140.py b/rcr/migrations/0021_auto_20240226_1140.py new file mode 100644 index 00000000..95ea3383 --- /dev/null +++ b/rcr/migrations/0021_auto_20240226_1140.py @@ -0,0 +1,21 @@ +# Generated by Django 5.0.2 on 2024-02-26 11:40 + +from django.db import migrations, models + +def move_radiology_categories(apps, schema_editor): + Item = apps.get_model("rcr", "Item") + #RadiologyCategory = apps.get_model("rcr", "RadiologyCategory") + for item in Item.objects.all(): + if item.radiology_category: + item.radiology_categories.add(item.radiology_category) + + +class Migration(migrations.Migration): + + dependencies = [ + ('rcr', '0020_item_radiology_categories'), + ] + + operations = [ + migrations.RunPython(move_radiology_categories), + ] diff --git a/rcr/models.py b/rcr/models.py index ca752099..abd50b9e 100644 --- a/rcr/models.py +++ b/rcr/models.py @@ -37,6 +37,7 @@ class Item(models.Model): rcr_platform_id = models.CharField(max_length=255, unique=True) radiology_category = models.ForeignKey("RadiologyCategory", on_delete=models.SET_NULL, null=True, blank=True, related_name="item_radiology") + radiology_categories = models.ManyToManyField("RadiologyCategory", blank=True, related_name="items_radiology") oncology_category = models.ForeignKey("OncologyCategory", on_delete=models.SET_NULL, null=True, blank=True, related_name="item_oncology") level = models.ManyToManyField("Level", blank=True) diff --git a/rcr/templates/rcr/index.html b/rcr/templates/rcr/index.html index af7a3337..e06c70b1 100644 --- a/rcr/templates/rcr/index.html +++ b/rcr/templates/rcr/index.html @@ -28,7 +28,7 @@
| Content Type | Name | Assessed By | |
|---|---|---|---|
| {{forloop.counter}}: | @@ -57,6 +57,10 @@ {% block css %}