From 84a8469ad0e0659f47c6b384c7961d0f5ad8cce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr> Date: Tue, 23 May 2017 21:10:57 +0200 Subject: [PATCH] administration modes are an enumerated type, not a external table. indirectly fixes #10 Former-commit-id: 752a49eea7d413544f8ad74478924847edb1c959 --- ippisite/db.sqlite3.REMOVED.git-id | 2 +- .../migrations/0023_auto_20170523_1858.py | 23 +++++++++++++++++++ ippisite/ippidb/models.py | 11 +++++---- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 ippisite/ippidb/migrations/0023_auto_20170523_1858.py diff --git a/ippisite/db.sqlite3.REMOVED.git-id b/ippisite/db.sqlite3.REMOVED.git-id index dc41e52d..226017b6 100644 --- a/ippisite/db.sqlite3.REMOVED.git-id +++ b/ippisite/db.sqlite3.REMOVED.git-id @@ -1 +1 @@ -2b15950995d163e68e50e2aabf1b4e9a4ff2dfeb \ No newline at end of file +0029ba376cb55048b9799efa8aaeccaaf33d350d \ No newline at end of file diff --git a/ippisite/ippidb/migrations/0023_auto_20170523_1858.py b/ippisite/ippidb/migrations/0023_auto_20170523_1858.py new file mode 100644 index 00000000..904209de --- /dev/null +++ b/ippisite/ippidb/migrations/0023_auto_20170523_1858.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.1 on 2017-05-23 18:58 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ippidb', '0022_auto_20170523_1311'), + ] + + operations = [ + migrations.AlterField( + model_name='testpkdescription', + name='administration_mode', + field=models.CharField(blank=True, choices=[('IV', ''), ('PO', ''), ('IP', ''), ('SL', 'SL')], max_length=2, null=True, verbose_name='Administration mode'), + ), + migrations.DeleteModel( + name='AdministrationMode', + ), + ] diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py index c2599e01..f012c911 100644 --- a/ippisite/ippidb/models.py +++ b/ippisite/ippidb/models.py @@ -361,14 +361,17 @@ class CompoundCytotoxicityResult(models.Model): class Meta: unique_together = (('compound', 'test_cytotoxicity_description'),) -class AdministrationMode(models.Model): - name = models.CharField('Administration mode', max_length=20, blank=True, null=True) - class TestPKDescription(models.Model): + ADMINISTRATION_MODES = ( + ('IV', ''), + ('PO', ''), + ('IP', ''), + ('SL', 'SL') + ) biblio = models.ForeignKey(Bibliography) test_name = models.CharField('Pharmacokinetic test name', max_length=100) organism = models.ForeignKey(Taxonomy) - administration_mode = models.ForeignKey(AdministrationMode, blank=True, null=True) + administration_mode = models.CharField('Administration mode', max_length=2, choices=ADMINISTRATION_MODES,blank=True, null=True) dose = models.DecimalField('Dose in mg/kg', max_digits=7, decimal_places=4, blank=True, null=True) dose_interval = models.IntegerField('Dose interval, in hours', blank=True, null=True) -- GitLab