diff --git a/core/sources/constants.py b/core/sources/constants.py index 9e48db24d..fc22d0189 100644 --- a/core/sources/constants.py +++ b/core/sources/constants.py @@ -7,3 +7,9 @@ CONTENT_REFERRED_PRIVATELY = 'Could not delete source "{}". One or more resources in the source are ' \ 'referenced by private repositories. Contact an OCL administrator for more information.' HIERARCHY_ROOT_MUST_BELONG_TO_SAME_SOURCE = 'Hierarchy Root must belong to the same Source.' +HIERARCHY_MEANINGS = ( + ('grouped-by', 'grouped-by'), + ('is-a', 'is-a'), + ('part-of', 'part-of'), + ('classified-with', 'classified-with'), +) diff --git a/core/sources/migrations/0018_auto_20210417_0430.py b/core/sources/migrations/0018_auto_20210417_0430.py new file mode 100644 index 000000000..c70b4acf9 --- /dev/null +++ b/core/sources/migrations/0018_auto_20210417_0430.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.8 on 2021-04-17 04:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sources', '0017_source_hierarchy_root'), + ] + + operations = [ + migrations.AlterField( + model_name='source', + name='hierarchy_meaning', + field=models.CharField(blank=True, choices=[('grouped-by', 'grouped-by'), ('is-a', 'is-a'), ('part-of', 'part-of'), ('classified-with', 'classified-with')], max_length=50, null=True), + ), + ] diff --git a/core/sources/models.py b/core/sources/models.py index 3488ee32d..ad5f923d6 100644 --- a/core/sources/models.py +++ b/core/sources/models.py @@ -8,7 +8,8 @@ from core.common.models import ConceptContainerModel from core.common.utils import reverse_resource, get_query_params_from_url_string from core.concepts.models import LocalizedText -from core.sources.constants import SOURCE_TYPE, SOURCE_VERSION_TYPE, HIERARCHY_ROOT_MUST_BELONG_TO_SAME_SOURCE +from core.sources.constants import SOURCE_TYPE, SOURCE_VERSION_TYPE, HIERARCHY_ROOT_MUST_BELONG_TO_SAME_SOURCE, \ + HIERARCHY_MEANINGS class Source(ConceptContainerModel): @@ -44,7 +45,7 @@ class Meta: source_type = models.TextField(blank=True, null=True) content_type = models.TextField(blank=True, null=True) collection_reference = models.CharField(null=True, blank=True, max_length=100) - hierarchy_meaning = models.CharField(null=True, blank=True, max_length=50) + hierarchy_meaning = models.CharField(null=True, blank=True, max_length=50, choices=HIERARCHY_MEANINGS) case_sensitive = models.BooleanField(null=True, blank=True, default=None) compositional = models.BooleanField(null=True, blank=True, default=None) version_needed = models.BooleanField(null=True, blank=True, default=None)