diff --git a/dfndb/admin.py b/dfndb/admin.py index dfc29311..1abfe2cf 100644 --- a/dfndb/admin.py +++ b/dfndb/admin.py @@ -18,7 +18,7 @@ class DataParameterInline(admin.TabularInline): class ComponentAdmin(BaseAdmin): - list_display = BaseAdmin.list_display + ["type", "polymer"] + list_display = BaseAdmin.list_display + ["type"] list_filter = BaseAdmin.list_filter + ["type"] inlines = (ComponentCompositionInline,) diff --git a/dfndb/forms.py b/dfndb/forms.py index cf00d953..5a52125f 100644 --- a/dfndb/forms.py +++ b/dfndb/forms.py @@ -66,7 +66,7 @@ class NewComponentForm(DataCreateForm): class Meta: model = Component - fields = ["name", "type", "polymer", "notes"] + fields = ["name", "type", "notes"] def __init__(self, *args, **kwargs): super(NewComponentForm, self).__init__(*args, **kwargs) @@ -76,7 +76,6 @@ def __init__(self, *args, **kwargs): Div(HTML("

Component

")), Column("name", css_class="col-4"), Column("type", css_class="col-4"), - Column("polymer", css_class="col-4"), Fieldset( "Composition", Div( diff --git a/dfndb/migrations/0017_remove_component_polymer.py b/dfndb/migrations/0017_remove_component_polymer.py new file mode 100644 index 00000000..8a8e194f --- /dev/null +++ b/dfndb/migrations/0017_remove_component_polymer.py @@ -0,0 +1,17 @@ +# Generated by Django 4.1.3 on 2022-12-09 11:04 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('dfndb', '0016_alter_compound_unique_together_alter_component_name_and_more'), + ] + + operations = [ + migrations.RemoveField( + model_name='component', + name='polymer', + ), + ] diff --git a/dfndb/models.py b/dfndb/models.py index 04b88338..6aa90c0d 100644 --- a/dfndb/models.py +++ b/dfndb/models.py @@ -52,12 +52,6 @@ class Component(cm.BaseModelMandatoryName): (4, "Separator"), ] type = models.PositiveSmallIntegerField(choices=MATERIAL_TYPE_CHOICES) - polymer = models.PositiveIntegerField( - default=0, - help_text=( - "Degree of polymerisation if this component is a polymer, otherwise 0" - ), - ) def __str__(self): return self.name or "" diff --git a/dfndb/templates/component.html b/dfndb/templates/component.html index 7edb4d6c..46793f8f 100644 --- a/dfndb/templates/component.html +++ b/dfndb/templates/component.html @@ -28,12 +28,6 @@
Component details

{{ object.get_type_display }}

- {% if object.polymer > 0 %} - Degree of polymerisation -
- {{ object.polymer }} -

- {% endif %} Composition
diff --git a/tests/dfndb/test_admin.py b/tests/dfndb/test_admin.py index 292629f1..daa3cf76 100644 --- a/tests/dfndb/test_admin.py +++ b/tests/dfndb/test_admin.py @@ -46,7 +46,7 @@ def test_component_admin(self): ma = ComponentAdmin(Component, self.site) self.assertEqual(ma.model, Component) self.assertEqual( - ma.get_list_display(request), BaseAdmin.list_display + ["type", "polymer"] + ma.get_list_display(request), BaseAdmin.list_display + ["type"] ) self.assertEqual(ma.get_list_filter(request), BaseAdmin.list_filter + ["type"]) self.assertTrue(site.is_registered(Component)) diff --git a/tests/dfndb/test_models.py b/tests/dfndb/test_models.py index 28b06d0c..614a0c0a 100644 --- a/tests/dfndb/test_models.py +++ b/tests/dfndb/test_models.py @@ -48,7 +48,7 @@ def setUp(self): ) comp2 = baker.make_recipe("tests.dfndb.compound", name="Sulphur", formula="S") self.model = baker.make_recipe( - "tests.dfndb.component", name="Contaminant", type=1, polymer=0 + "tests.dfndb.component", name="Contaminant", type=1 ) baker.make_recipe( "tests.dfndb.composition_part", @@ -72,7 +72,6 @@ def test_component_creation(self): self.assertEqual(self.model.composition.all().count(), 2) self.assertEqual(self.model.composition.get(name=name), cmp) self.assertEqual(self.model.type, 1) - self.assertEqual(self.model.polymer, 0) def test_str(self): self.assertEqual(self.model.__str__(), "Contaminant")