Activity page map#298
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for rendering a related-record map on Activity and Place‑Resource Event record pages (while intentionally avoiding related maps on Place pages) by including map geometry in related objects’ get_query_json() output and updating the record view/template to conditionally render the map block.
Changes:
- Add
Places.get_query_json()override to include map geometry when available. - Update
get_by_model_idto detect related geo records and control map rendering via ashow_mapflag on relationships. - Simplify
record.htmlmap condition to rely onrelationship.show_map, and add model tests for newget_query_json()behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| TEKDB/TEKDB/models.py | Adds Places.get_query_json() map data so related places can drive map rendering. |
| TEKDB/explore/views.py | Computes whether to load map context and whether a relationship should render a map. |
| TEKDB/explore/templates/record.html | Switches map rendering condition to use the new relationship.show_map flag. |
| TEKDB/TEKDB/tests/test_models.py | Adds tests asserting Places.get_query_json() includes/omits map appropriately. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+213
to
+217
| if "map" in value.keys() and value["map"] is not None: | ||
| hasPlaceResourceRelationships = True | ||
| break | ||
| if hasPlaceResourceRelationships: | ||
| break | ||
| found_related_geo_record = True | ||
| relationship["show_map"] = True | ||
| else: | ||
| relationship["show_map"] = False |
Comment on lines
+516
to
+518
| """ | ||
| Test that the response from get_query_json includes no map data when map is False | ||
| """ |
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.
asana task
Description
Displays a map on Activity and Place-Resource Event pages in the related materials section. It does not display a map for a related activity or place resource on a Place page, as there is already a map on that page.
I also simplified the logic in the
record.htmltemplate since there are now more conditions to show the related map.Screenshots
Activity Page
Place-Resource Page
Place page (no related map)