This commit is contained in:
Ross
2021-11-28 14:48:31 +00:00
parent 75970fd4c8
commit bed121102c
2 changed files with 52 additions and 13 deletions
@@ -0,0 +1,34 @@
# Generated by Django 3.2.4 on 2021-11-28 14:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('atlas', '0005_condition_primary_name'),
]
operations = [
migrations.CreateModel(
name='Subspecialty',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
],
),
migrations.RemoveField(
model_name='case',
name='subspecialty',
),
migrations.AddField(
model_name='condition',
name='subspecialty',
field=models.ManyToManyField(blank=True, to='atlas.Subspecialty'),
),
migrations.AddField(
model_name='case',
name='subspecialty',
field=models.ManyToManyField(blank=True, to='atlas.Subspecialty'),
),
]
+18 -13
View File
@@ -81,6 +81,8 @@ class Condition(models.Model):
primary_name = models.BooleanField(default="True")
subspecialty = models.ManyToManyField("subspecialty", blank=True)
def __str__(self) -> str:
if self.synonym.count() == 0:
return self.name
@@ -88,21 +90,23 @@ class Condition(models.Model):
synonyms = ",".join([i.name for i in self.synonym.all()])
return f"{self.name} ({synonyms})"
class Subspecialty(models.Model):
name = models.CharField(max_length=255)
@reversion.register
class Case(models.Model):
class SubspecialtyChoices(models.TextChoices):
BREAST = "BR", _("Breast")
CARDIAC = "CA", _("Cardiac")
GASTRO = "GI", _("Gastrointestinal and hepatobiliary")
HEADNECK = "HN", _("Head and Neck")
MSK = "MS", _("Musculoskeletal")
NEURO = "NE", _("Neuroradiology")
OBSGYN = "OG", _("Obstectric and Gynaecological")
PAED = "PA", _("Paediatric")
URO = "UR", _("Uroradiology")
VASC = "VA", _("Vascular")
HAEMONC = "HA", _("Haemotology and Oncology")
#class SubspecialtyChoices(models.TextChoices):
# BREAST = "BR", _("Breast")
# CARDIAC = "CA", _("Cardiac")
# GASTRO = "GI", _("Gastrointestinal and hepatobiliary")
# HEADNECK = "HN", _("Head and Neck")
# MSK = "MS", _("Musculoskeletal")
# NEURO = "NE", _("Neuroradiology")
# OBSGYN = "OG", _("Obstectric and Gynaecological")
# PAED = "PA", _("Paediatric")
# URO = "UR", _("Uroradiology")
# VASC = "VA", _("Vascular")
# HAEMONC = "HA", _("Haemotology and Oncology")
title = models.CharField(max_length=255, help_text="Title of the case", default="")
# author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
@@ -116,7 +120,8 @@ class Case(models.Model):
findings = models.TextField(null=True, blank=True)
subspecialty = models.CharField(max_length=2, choices=SubspecialtyChoices.choices)
#subspecialty = models.CharField(max_length=2, choices=SubspecialtyChoices.choices)
subspecialty = models.ManyToManyField(Subspecialty, blank=True)
condition = models.ManyToManyField(Condition, blank=True)