Skip to content

Commit

Permalink
[Fixes #110] Feature: add metadata license to resource base
Browse files Browse the repository at this point in the history
  • Loading branch information
mwallschlaeger committed Jun 20, 2024
1 parent 0ab6376 commit 6f41068
Show file tree
Hide file tree
Showing 6 changed files with 85 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
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 6f41068

Please sign in to comment.