Skip to content

Commit

Permalink
update use constrains to use constraints and solve bug in related ide…
Browse files Browse the repository at this point in the history
…nfiers
  • Loading branch information
silvadealmeida committed Aug 21, 2024
1 parent 0c9caeb commit 6034c57
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion geonode/api/resourcebase_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class CommonModelApi(ModelResource):
"purpose",
"maintenance_frequency",
"use_constraint_restrictions",
"use_constrains",
"use_constraints",
"restriction_other",
"constraints_other",
"license",
Expand Down
4 changes: 2 additions & 2 deletions geonode/base/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ def __init__(self, *args, **kwargs):
self.fields["use_constraint_restrictions"] = ComplexDynamicRelationField(
RestrictionCodeTypeSerializer, embed=True, many=True
)
self.fields["use_constrains"] = serializers.CharField(read_only=True)
self.fields["use_constraints"] = serializers.CharField(read_only=True)
self.fields["restriction_other"] = ComplexDynamicRelationField(
RestrictionCodeTypeSerializer, embed=True, many=True
)
Expand Down Expand Up @@ -795,7 +795,7 @@ class Meta:
"purpose",
"maintenance_frequency",
"use_constraint_restrictions",
"use_constrains",
"use_constraints",
"constraints_other",
"restriction_other",
"license",
Expand Down
2 changes: 1 addition & 1 deletion geonode/base/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ class ResourceBaseForm(TranslationModelForm, LinkedResourceForm):
widget=forms.SelectMultiple(attrs={"class": "bg-primary"}),
required=False,
)
use_constrains = forms.CharField(label=_("Use Constraints"), required=False, widget=TinyMCE())
use_constraints = forms.CharField(label=_("Use Constraints"), required=False, widget=TinyMCE())
constraints_other = forms.CharField(label=_("Other constraints"), required=False, widget=TinyMCE())

supplemental_information = forms.CharField(label=_("Supplemental information"), required=False, widget=TinyMCE())
Expand Down
13 changes: 7 additions & 6 deletions geonode/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,9 @@ def __str__(self):

class RelatedIdentifier(models.Model):
related_identifer_help_text = _("Identifiers of related resources. These must be globally unique identifiers.")
related_identifier = models.CharField(max_length=255, help_text=related_identifer_help_text)
related_identifier_type = models.ForeignKey(RelatedIdentifierType, on_delete=models.CASCADE)
relation_type = models.ForeignKey(RelationType, on_delete=models.CASCADE)
related_identifier = models.CharField(max_length=255, help_text=related_identifer_help_text, blank=True)
related_identifier_type = models.ForeignKey(RelatedIdentifierType, null=True, blank=True, on_delete=models.CASCADE)
relation_type = models.ForeignKey(RelationType, null=True, blank=True, on_delete=models.CASCADE)

def __str__(self):
return f"Related Identifier: {self.related_identifier}({self.relation_type}: {self.related_identifier_type})"
Expand Down Expand Up @@ -788,7 +788,7 @@ class ResourceBase(PolymorphicModel, PermissionLevelMixin, ItemBase):
"(space or comma-separated)"
)
regions_help_text = _("keyword identifies a location")
use_constrains_help_text = _(
use_constraints_help_text = _(
"This metadata element shall provide information on the Use constraints applied to assure the protection of privacy or intellectual property (e.g. Trademark)"
)
restriction_other_help_text = _("limitation(s) placed upon the access or use of the data.")
Expand Down Expand Up @@ -961,7 +961,7 @@ class ResourceBase(PolymorphicModel, PermissionLevelMixin, ItemBase):
blank=True,
)

use_constrains = models.TextField(_("Use Constraints"), null=True, blank=True)
use_constraints = models.TextField(_("Use Constraints"), null=True, blank=True)
restriction_other = models.ManyToManyField(
RestrictionCodeType,
verbose_name=_("restrictions"),
Expand Down Expand Up @@ -1143,10 +1143,11 @@ class ResourceBase(PolymorphicModel, PermissionLevelMixin, ItemBase):
# Bonares
related_identifier = models.ManyToManyField(
RelatedIdentifier,
verbose_name=_("Related Identifier"),
null=True,
blank=True,
help_text=related_identifer_help_text,
# related_name="related_identifier",
verbose_name=_("Related Identifier"),
)
funders = models.ManyToManyField(
Funder, verbose_name=_("Funder names"), null=True, blank=True, help_text=funders_help_text
Expand Down

0 comments on commit 6034c57

Please sign in to comment.