You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently LinkedResource only stores a generic relationship between a source and a target resource. The only distinction is the internal flag, which the client uses to show "Uses / Used by" for maps and their datasets, and "Linked to / Linked by" for everything else. The meaning of the relationship is implicit in the code, both in the backend and in the client.
We want to add a relation_type field to make it explicit. It reads as <source> <relation_type> <target>:
related: the generic link set by users from the metadata editor or the API (default)
uses: a map and its datasets, calculated from the map layers as it is now
clone_of: set when a resource is cloned (Save as)
clone_of is the first new use. At the moment a cloned resource keeps no trace of the resource it was cloned from.
The linked_resources API will return the relation_type of each item and accept it as a filter. internal will still be returned for backward compatibility, but it's deprecated.
The link between a map and its map viewer is also a generic link, and the client finds the viewer by looking for a linked resource of type mapviewer. It should get its own type, but this requires changes in the client too, so it will be done later. In the meantime the map viewer will be excluded from the "Related resources" field of the metadata editor for maps, where it can be removed or replaced by mistake.
Cloning a map still copies the related link to its map viewer, so the clone shares the original's viewer. The copy should skip it.
Do we really want to exclude the viewer from the cloned map? I'm not so sure...
The migration turns internal=True rows into uses, but the description says all existing links become related
The idea is that in case someone (third party code, whatevere) stored that value, the equivalent with the new types would be "uses".
This is only a theoritcal edge case, because GeoNode's current code never stored internal=True , and it will not store "use". They're computed at runtime.
So the migration covers edge cases, not the current usage from GeoNode itself.
The migration rollback sets every row back to internal=False. Add a reverse function that restores internal=True for uses.
Again, this would cover an edge case. In reality, nothing will save "uses" now, and nothing would use internal=True after a revert. This is just in case some custom code would have.
I would probably remove both the forward and backwards migration steps.
Minor: in linked_resources, use a fixed error message instead of echoing the user's relation_type
Activity
mattiagiupponi commentedon Nov 23, 2026
Few notes:
[Fixes #14780] Add a relation type to LinkedResource
[Fixes #14780] Add a relation type to LinkedResource
giohappy commentedon Nov 26, 2026
Do we really want to exclude the viewer from the cloned map? I'm not so sure...
The idea is that in case someone (third party code, whatevere) stored that value, the equivalent with the new types would be "uses".
This is only a theoritcal edge case, because GeoNode's current code never stored internal=True , and it will not store "use". They're computed at runtime.
So the migration covers edge cases, not the current usage from GeoNode itself.
Again, this would cover an edge case. In reality, nothing will save "uses" now, and nothing would use internal=True after a revert. This is just in case some custom code would have.
I would probably remove both the forward and backwards migration steps.
Why?
giohappy commentedon Nov 26, 2026
@mattiagiupponi I've removed the forward migration that converts internal=True to uses. It was... useless :)