migrate categories to a multiselect
This commit is contained in:
@@ -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'),
|
||||
),
|
||||
]
|
||||
@@ -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),
|
||||
]
|
||||
@@ -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)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<table>
|
||||
<tr><th></th><th>Content Type</th><th>Name</th><th>Assessed<br/> By</th></tr>
|
||||
{% for item in items %}
|
||||
<tr class="{{item.content_type}} {% if item.completed_radiology %} completed-radiology{% endif %}{% if item.completed_oncology %} completed-oncology{% endif %}">
|
||||
<tr class="{{item.content_type}} {% if item.completed_radiology %} completed-radiology{% endif %}{% if item.completed_oncology %} completed-oncology{% endif %}{% if item.needs_review %} review{% endif %}">
|
||||
<td class="{{item.specialty}}" title="{{item.specialty}}">
|
||||
{{forloop.counter}}:
|
||||
</td>
|
||||
@@ -57,6 +57,10 @@
|
||||
{% block css %}
|
||||
|
||||
<style type="text/css">
|
||||
.review::after {
|
||||
content: '(R)';
|
||||
color: orange;
|
||||
}
|
||||
.completed-radiology::after {
|
||||
content: '✓';
|
||||
color: green;
|
||||
|
||||
@@ -5,12 +5,17 @@
|
||||
{% include "rcr/item_rcr_details.html" %}
|
||||
|
||||
<p>Radiology Category: {{object.radiology_category}}</p>
|
||||
<p>Radiology Categories:
|
||||
{% for category in object.radiology_categories.all %}
|
||||
{{category}}
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>Oncology Category: {{object.oncology_category}}</p>
|
||||
|
||||
<p>
|
||||
Level(s):
|
||||
Level(s):
|
||||
{% for level in object.level.all %}
|
||||
{{level}},
|
||||
{{level}},
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
||||
@@ -32,9 +37,9 @@
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Assessor(s):
|
||||
Assessor(s):
|
||||
{% for ass in object.assessed_by.all %}
|
||||
{{ass}},
|
||||
{{ass}},
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user