Skip to content

Commit

Permalink
Merge pull request #125 from zalf-rdm/issue_#110_Feature_add_metadata…
Browse files Browse the repository at this point in the history
…_license_to_resource_base

[Fixes #110] Feature: add metadata license to resource base
  • Loading branch information
mwallschlaeger authored Jun 25, 2024
2 parents 0ab6376 + 0feb331 commit 7042093
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 0 deletions.
1 change: 1 addition & 0 deletions geonode/base/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ def __init__(self, *args, **kwargs):
RestrictionCodeTypeSerializer, embed=True, many=True
)
self.fields["license"] = ComplexDynamicRelationField(LicenseSerializer, embed=True, many=False)
self.fields["metadata_license"] = ComplexDynamicRelationField(LicenseSerializer, embed=True, many=False)
self.fields["spatial_representation_type"] = ComplexDynamicRelationField(
SpatialRepresentationTypeSerializer, embed=True, many=False
)
Expand Down
1 change: 1 addition & 0 deletions geonode/base/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ def test_resource_serializer_validation(self):
category=TopicCategory.objects.get(identifier="elevation"),
resource_type="dataset",
license=License.objects.all().first(),
metadata_license=License.objects.all().first(),
restriction_code_type=RestrictionCodeType.objects.all().first(),
group=Group.objects.all().first(),
).save()
Expand Down
19 changes: 19 additions & 0 deletions geonode/base/migrations/0097_resourcebase_metadata_license.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.23 on 2024-06-18 14:01

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('base', '0096_merge_0088_auto_20231019_1244_0095_auto_20230331_0923'),
]

operations = [
migrations.AddField(
model_name='resourcebase',
name='metadata_license',
field=models.ForeignKey(blank=True, help_text='license of the metadata', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='metadata_license', to='base.license', verbose_name='Metadata License'),
),
]
11 changes: 11 additions & 0 deletions geonode/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ class ResourceBase(PolymorphicModel, PermissionLevelMixin, ItemBase):
"other restrictions and legal prerequisites for accessing and using the resource or" " metadata"
)
license_help_text = _("license of the dataset")
metadata_license_help_text = _("license of the metadata")
language_help_text = _("language used within the dataset")
category_help_text = _(
"high-level geographic data thematic classification to assist in the grouping and search of "
Expand Down Expand Up @@ -964,6 +965,16 @@ class ResourceBase(PolymorphicModel, PermissionLevelMixin, ItemBase):
help_text=license_help_text,
on_delete=models.SET_NULL,
)

metadata_license = models.ForeignKey(
License,
null=True,
blank=True,
related_name="metadata_license",
verbose_name=_("Metadata License"),
help_text=metadata_license_help_text,
on_delete=models.SET_NULL,
)
language = models.CharField(
_("language"), max_length=3, choices=enumerations.ALL_LANGUAGES, default="eng", help_text=language_help_text
)
Expand Down
18 changes: 18 additions & 0 deletions geonode/documents/migrations/0039_alter_document_abstract_en.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.23 on 2024-06-18 14:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('documents', '0038_alter_document_doc_url'),
]

operations = [
migrations.AlterField(
model_name='document',
name='abstract_en',
field=models.TextField(help_text='brief narrative summary of the content of the resource(s)', max_length=2000, null=True, verbose_name='abstract'),
),
]
18 changes: 18 additions & 0 deletions geonode/layers/migrations/0045_alter_dataset_abstract_en.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.23 on 2024-06-18 14:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('layers', '0044_alter_dataset_unique_together'),
]

operations = [
migrations.AlterField(
model_name='dataset',
name='abstract_en',
field=models.TextField(help_text='brief narrative summary of the content of the resource(s)', max_length=2000, null=True, verbose_name='abstract'),
),
]
18 changes: 18 additions & 0 deletions geonode/maps/migrations/0044_alter_map_abstract_en.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.23 on 2024-06-18 14:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('maps', '0043_auto_20230807_1234'),
]

operations = [
migrations.AlterField(
model_name='map',
name='abstract_en',
field=models.TextField(help_text='brief narrative summary of the content of the resource(s)', max_length=2000, null=True, verbose_name='abstract'),
),
]

0 comments on commit 7042093

Please sign in to comment.