-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use URL reversing #7740
Comments
First batch of explicit URLs found:
|
diff --git a/geonode/layers/templates/layers/layer_detail.html b/geonode/layers/templates/layers/layer_detail.html
index a6a64c618..278404b23 100644
--- a/geonode/layers/templates/layers/layer_detail.html
+++ b/geonode/layers/templates/layers/layer_detail.html
@@ -554,8 +554,8 @@
{% trans "Full metadata" %}
</h5>
<ul>
- <li><a target="_blank" href="../catalogue/csw_to_extra_format/{{resource.uuid}}/{{resource.title | slugify }}.txt"> {% trans "Text format" %} </a></li>
- <li><a target="_blank" href="../catalogue/csw_to_extra_format/{{resource.uuid}}/{{resource.title | slugify }}.html"> {% trans "HTML format" %} </a></li>
+ <li><a target="_blank" href="{% url 'csw_render_extra_format_txt' resource.uuid resource.title|slugify %}"> {% trans "Text format" %} </a></li>
+ <li><a target="_blank" href="{% url 'csw_render_extra_format_html' resource.uuid resource.title|slugify %}"> {% trans "HTML format" %} </a></li>
</ul>
</div>
<div style="margin-bottom:20px">
@@ -691,7 +691,7 @@
{% if resource.storeType == "remoteStore" %}
<li class="list-group-item">
<h4>{% trans "External service layer" %}</h4>
- <div>{% trans "Source" %}: <a href="/services/{{resource.remote_service.id}}">{{ resource.remote_service.title }}</a>
+ <div>{% trans "Source" %}: <a href="{% url 'service_detail' resource.remote_service.id %}">{{ resource.remote_service.title }}</a>
</div>
<div>{% trans "Type" %}: {{ resource.remote_service.type }}</div>
</li>
|
These are some of templates to be fixed yet: $ find geonode -name "*.html" | xargs grep 'href="/'
geonode/client/templates/leaflet/maps/map_edit.html: <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"/>
geonode/client/templates/leaflet/maps/map_view.html: <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"/>
geonode/templates/metadata_detail.html: <dd><a href="/search/?category__identifier__in={{ resource.category.identifier }}">{{ resource.category }}</a> {% if resource.category.description %}<a href="#category-more" data-toggle="collapse" data-target=".category-more"><i class="fa fa-info-circle"></i></a>{% endif %}</dd>
geonode/templates/metadata_detail.html: <dd><a href="/groups/group/{{ resource.group.name }}/activity/">{{ group }}</a> </dd>
geonode/templates/help.html: <p>The <a href="/layers">Layers</a> tab allows you to browse data uploaded to this GeoNode.</p>
geonode/templates/help.html: <p>The <a href="/developer"> Developer</a> page is the place for developers to get started building applications against the GeoNode. It includes instructions on using the web services, links to the source code of the GeoNode, and information about the open source projects used to create it.</p>
geonode/templates/help.html: <p>The <a href="/maps">Maps</a> tab is a gateway to map exploration on GeoNode. From here you can <strong>search for a map</strong> or <strong>create a map</strong>, which will open the <a href="/maps/new">Map Composer</a>.</p>
geonode/templates/help.html: <p>To create a new map go to the <a href="/maps">Contributed Maps</a> tab and click the <a href="/maps/new">create your own map</a> link.</p>
geonode/templates/help.html: <p>This will take you to the <a href="/maps/new">Map Composer</a> with a base layer loaded.</p>
geonode/templates/help.html: <p>Note that the <a href="/maps/new">Map Composer</a> also has a button to publish the map. Just be sure to save the map before publishing if there are changes that you want others to see. It publishes the last saved version, not the last viewed version.</p>
geonode/templates/help.html: <p>You will be able to see your new map when you search for it from the <a href="/maps">Maps</a> tab.</p>
geonode/templates/privacy-cookies.html:<p style="text-align: justify;"><a class="navbar-brand" style="background-color: #028BAF" href="/">GeoNode</a></p>
geonode/templates/500.html: <li><a href="/admin/people/profile/add/">{% trans "Add User" %}</a></li>
geonode/templates/500.html: <li><a title="{% trans "Help" %}" rel="tooltip" href="/help/"><i class="fa fa-question-circle"></i> {% trans "Help" %}</a></li>
geonode/base/templates/base/_resourcebase_info_panel.html: <dd><a href="/groups/group/{{ resource.group.name }}/activity/">{{ group }}</a> </dd>
geonode/layers/templates/layers/layer_change_poc.html:{% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% trans "Home" %}</a> › {% trans "Change point of contact" %}</div>{% endblock %}
geonode/layers/templates/layers/layer_style_manage.html: Manage Available Styles for <a href="/layers/{{ layer_title }}">{{ layer_title }}</a>
geonode/static/geonode/js/templates/upload.html: a href="/data/geonode:<%= name %>" class='btn'>Layer page</a> |
The file |
Can't find how to reverse https://github.com/GeoNode/geonode/blob/3.2.0/geonode/layers/views.py#L1293 |
@etj I suspect that |
* [#7740] Use URL reversing * [#7740] Use URL reversing: po files * [#7740] Use URL reversing: more changes in po files * [#7740] Use URL reversing * [#7740] Use URL reversing: py files * [#7740] Use URL reversing: py files * [#7740] Use URL reversing - fixes * [#7740] Use URL reversing - fixes * [#7740] Use URL reversing - fixes
* [GeoNode#7740] Use URL reversing * [GeoNode#7740] Use URL reversing: po files * [GeoNode#7740] Use URL reversing: more changes in po files * [GeoNode#7740] Use URL reversing * [GeoNode#7740] Use URL reversing: py files * [GeoNode#7740] Use URL reversing: py files * [GeoNode#7740] Use URL reversing - fixes * [GeoNode#7740] Use URL reversing - fixes * [GeoNode#7740] Use URL reversing - fixes
Fix reverse urls for get_url_for_app_model and get_url_for_model methods
* [#7740] Use URL reversing (#7746) * [#7740] Use URL reversing * [#7740] Use URL reversing: po files * [#7740] Use URL reversing: more changes in po files * [#7740] Use URL reversing * [#7740] Use URL reversing: py files * [#7740] Use URL reversing: py files * [#7740] Use URL reversing - fixes * [#7740] Use URL reversing - fixes * [#7740] Use URL reversing - fixes * [Fixes #7771] Fix flake8 issues * [Fixes #7771] Fix reverse urls for get_url_for_app_model and get_url_for_model methods Co-authored-by: Emanuele Tajariol <[email protected]>
* [Fixes #7740] Fix reverse urls Fix reverse urls for get_url_for_app_model and get_url_for_model methods * Remove unused import * Fix flake8 formatting
* [Backport Resolves #7392] Fix upload/replace/append layer * [Fixes #7740] Fix reverse urls Fix reverse urls for get_url_for_app_model and get_url_for_model methods * Remove unused import * Fix flake8 formatting * [Fixes #7740] Reverse url fix for tests * [Fixes #7801] Fix broken tests for 3.2.x build * [Fixes #7801] Fix flake8 error
Is your feature request related to a problem? Please describe.
In the code (both python and HTML templates) there are explicit URLs toward the internal GeoNode services.
If for some reason these URLs are programmatically changed (for instance for adding a root context path), the templates need to be modified/overridden in order to use the modified URLs.
Most of the code already uses URL reversal resolution, but in some cases URL are still composed by hand.
Describe the solution you'd like
URL reverse functions should be used whenever possibile.
HTML code like
should be modified so to use the
{% url %}
tag:Python code like:
should be modified as well.
The text was updated successfully, but these errors were encountered: