Repository navigation
[Fixes #14801] Metadata: improve SpatialRepresentationType handling - #14802
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the update to human-readable spatial representation labels.
No open issues 🎉
What changed in this PR
Updates spatial representation type labels in the metadata editor to human-readable names, addressing #14801 while leaving ISO identifiers in XML output unchanged.
Changes:
- Uses translated
gn_descriptionvalues for dropdown labels. - Adds short labels to fixtures and a guarded data migration that preserves customized descriptions.
- Updates the handler test to expect the display label rather than the identifier.
| File | Description |
|---|---|
geonode/metadata/tests/test_handlers.py |
Updates test data and assertions for human-readable labels. |
geonode/metadata/handlers/base.py |
Uses translated gn_description values as option titles. |
geonode/base/migrations/0103_spatialrepresentationtype_gn_description_labels.py |
Adds a reversible migration guarded by original fixture descriptions. |
geonode/base/fixtures/initial_data.json |
Supplies six short labels for fresh installations. |
Review effort: Balanced
8 tasks done
sijandh35
approved these changes
Dec 1, 2026
etj
force-pushed
the
14801_spatial_representation_type_label
branch
from
December 1, 2026 14:19
62a6fe0 to
c68a849
Compare
sijandh35
approved these changes
Dec 1, 2026
Contributor
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-5.1.x 5.1.x
# Navigate to the new working tree
cd .worktrees/backport-5.1.x
# Create a new branch
git switch --create backport-14802-to-5.1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 644c7127e69f9394ce9ec1076ade0efac62cb908
# Push it to GitHub
git push --set-upstream origin backport-14802-to-5.1.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-5.1.xThen, create a pull request where the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Show a human-readable label for spatial representation type
The spatial representation type field showed the raw ISO identifier (
vector,grid,textTable, ...) instead of a human-readable label, in two places:metadata_field_value.htmlingeonode-mapstore-client(Metadata: SpatialRepresentationType rendering #14810)The editor case (#14801) was a simple title lookup:
SpatialRepresentationTypeSubHandlerwas using the identifier as theoneOftitle instead ofgn_description.The view-metadata case (#14810) couldn't be fixed the same way: that template has no schema access, so it has no way to resolve a label from a plain
oneOf-enumerated string value — the value stored in the resource's metadata was just the bare identifier (e.g."vector"), with no label alongside it. Fixing this required changing what the field's value actually carries, not just how the editor displays it.Fix
SpatialRepresentationTypeSubHandler: title now usesgn_descriptioninstead ofidentifierfor the (now superseded)oneOfentries.Vector,Grid,Text table,TIN / Triangulated irregular network,Stereo model,Video) set on existingSpatialRepresentationTyperows, guarded to only touch rows still holding the original fixture description.initial_data.jsonupdated for fresh installs.spatial_representation_typechanged from a plain string with aoneOfenum to an{id, label}object, the same convention already used forcategoryandlicense. The value serialized onto a resource now carries its own label (e.g.{"id": "vector", "label": "Vector"}), so any consumer — including the view-metadata template — can render it without a schema-side lookup.oneOfenum with an autocomplete endpoint (GET /api/v2/metadata/autocomplete/spatial_representation_types, optional?q=filter), matching thecategories/licensesautocomplete pattern, instead of hardcoding the options in the schema.full_metadata.xmloutput is unchanged — it intentionally keeps using the bare ISO identifier.Files
geonode/metadata/handlers/base.py—SpatialRepresentationTypeSubHandlerrewritten to the autocomplete/object pattern.geonode/metadata/schemas/base.json—spatial_representation_typeschema changed to{id, label}object.geonode/metadata/api/views.py/geonode/metadata/api/urls.py— newspatial_representation_types_autocompleteendpoint.geonode/metadata/tests/test_handlers.py/geonode/metadata/tests/tests.py— updated/added tests for the new handler behavior and the autocomplete endpoint.initial_data.json+ earliertest_handlers.pylabel assertions.Checklist
For all pull requests:
The following are required only for core and extension modules (they are welcomed, but not required, for contrib modules):
Submitting the PR does not require you to check all items, but by the time it gets merged, they should be either satisfied or inapplicable.