summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelley Spoon <kelley.spoon@linaro.org>2021-09-18 12:34:50 -0500
committerKelley Spoon <kelley.spoon@linaro.org>2021-09-18 12:47:33 -0500
commitd516e489ad37c6f88575b7951e27b9d31e0bb6b5 (patch)
tree94ccaded5edacef7dec1264025474bb29d0740d9
parent6010265cf7b56c9b7b255c74718c9bd20f15823b (diff)
patchwork: add names to url patterns
In a previous version of django, changes were made to how django resolves view functions and introduced 'namespaces'. As a result, some of the references in our old templates to views by a str rep of the view function no longer work and django is unable to figure out the url for a view. Let's just update the old method and use the "correct" method of specifying a name in urlpattern and using that name in our templates to call the url filter. Change-Id: If3a10c59a28efe96fc81725885c835aff5821d5f
-rw-r--r--linaro_metrics/templates/linaro_metrics/index.html6
-rw-r--r--linaro_metrics/templates/linaro_metrics/projects.html2
-rw-r--r--linaro_metrics/templates/linaro_metrics/teams.html2
-rw-r--r--linaro_metrics/urls.py19
-rw-r--r--linaro_metrics/views.py4
5 files changed, 18 insertions, 15 deletions
diff --git a/linaro_metrics/templates/linaro_metrics/index.html b/linaro_metrics/templates/linaro_metrics/index.html
index 0c5d0bf..5504a59 100644
--- a/linaro_metrics/templates/linaro_metrics/index.html
+++ b/linaro_metrics/templates/linaro_metrics/index.html
@@ -135,7 +135,7 @@ function selectTab(item) {
When analyzing the charts above, please take into account that the process
which allows us to track patches was put in place at the end of January 2011
and that this website went live in June 2011. Check the
-<a href="{% url 'linaro_metrics.views.faq_view' %}">FAQ</a> for answers to common
+<a href="{% url 'faq_view' %}">FAQ</a> for answers to common
questions.<br/><br/>
<div class="pure-menu pure-menu-horizontal">
@@ -165,7 +165,7 @@ questions.<br/><br/>
<div id="projects" style="display:None">
<ul>
{% for p in projects %}
- <li><a href="{% url 'patchwork.views.patch.patch_list' project_id=p.linkname %}">{{p.name}}</a></li>
+ <li><a href="{% url 'patch-list' project_id=p.linkname %}">{{p.name}}</a></li>
{% endfor %}
</ul>
</div>
@@ -174,7 +174,7 @@ questions.<br/><br/>
<div id="old-teams" style="display:None">
<ul>
{% for t in old_teams %}
- <li><a href="{% url 'linaro_metrics.views.team_view' team=t.name %}">{{t.display_name}}</a></li>
+ <li><a href="{% url 'team_view' team=t.name %}">{{t.display_name}}</a></li>
{% endfor %}
</ul>
</div>
diff --git a/linaro_metrics/templates/linaro_metrics/projects.html b/linaro_metrics/templates/linaro_metrics/projects.html
index 85d7a9b..34ca9b5 100644
--- a/linaro_metrics/templates/linaro_metrics/projects.html
+++ b/linaro_metrics/templates/linaro_metrics/projects.html
@@ -8,7 +8,7 @@
<ul>
{% for p in projects %}
<li>
- <a href="{% url 'patchwork.views.patch.patch_list' project_id=p.linkname %}">{{p.name}}</a>
+ <a href="{% url 'patch_list' project_id=p.linkname %}">{{p.name}}</a>
</li>
{% endfor %}
</ul>
diff --git a/linaro_metrics/templates/linaro_metrics/teams.html b/linaro_metrics/templates/linaro_metrics/teams.html
index 6f1697a..6223935 100644
--- a/linaro_metrics/templates/linaro_metrics/teams.html
+++ b/linaro_metrics/templates/linaro_metrics/teams.html
@@ -9,7 +9,7 @@
<ul>
{% for t in teams %}
<li>
- <a href="{% url 'linaro_metrics.views.team_view' team=t.name %}">{{t.name}}</a>
+ <a href="{% url 'team_view' team=t.name %}">{{t.name}}</a>
</li>
{% endfor %}
</ul>
diff --git a/linaro_metrics/urls.py b/linaro_metrics/urls.py
index ca864e2..4ddcd2e 100644
--- a/linaro_metrics/urls.py
+++ b/linaro_metrics/urls.py
@@ -10,21 +10,24 @@ admin.autodiscover()
urlpatterns = [
# Provide our override views of things in patchwork
url(r'^$', linaro_metrics.views.index_view),
+ # Include all the standard patchwork urls.
+ url(r'^', include(patchwork.urls)),
url(r'^project/(?P<project_id>[^/]+)/list/$',
linaro_metrics.views.project_view),
url(r'^register/', linaro_metrics.views.user_register),
- # Include all the standard patchwork urls.
- url(r'^', include(patchwork.urls)),
# Now provide our own urls.
- url(r'^faq$', linaro_metrics.views.faq_view),
- url(r'^team/$', linaro_metrics.views.team_overview),
- url(r'^projects/$', linaro_metrics.views.project_overview),
- url(r'^team/(?P<team>[^/]+)/$', linaro_metrics.views.team_view),
- url(r'^patches/(?P<user>[^/]+)/$', linaro_metrics.views.user_view),
+ url(r'^faq$', linaro_metrics.views.faq_view, name='faq_view'),
+ url(r'^team/$', linaro_metrics.views.team_overview, name='team_overview'),
+ url(r'^projects/$', linaro_metrics.views.project_overview,
+ name='project_overview'),
+ url(r'^team/(?P<team>[^/]+)/$', linaro_metrics.views.team_view,
+ name='team_view'),
+ url(r'^patches/(?P<user>[^/]+)/$', linaro_metrics.views.user_view,
+ name='user_view'),
url(r'^reports/project_activity$',
- linaro_metrics.views.report_project_activity),
+ linaro_metrics.views.report_project_activity, name='project_activity'),
url(r'^reports/non-author-sign-offs$',
linaro_metrics.views.report_signed_off_non_author),
diff --git a/linaro_metrics/views.py b/linaro_metrics/views.py
index 329e11b..2b98b79 100644
--- a/linaro_metrics/views.py
+++ b/linaro_metrics/views.py
@@ -148,7 +148,7 @@ def team_view(request, team):
month = 6
context = _non_project_ctx(
- request, 'linaro_metrics.views.team_view', view_args, patches)
+ request, 'team_view', view_args, patches)
context.update({
'team': team,
'memberships': TeamMembership.objects.filter(team=team),
@@ -169,7 +169,7 @@ def user_view(request, user):
view_args = {'user': user.id}
- context = _non_project_ctx(request, 'linaro_metrics.views.user_view',
+ context = _non_project_ctx(request, 'user_view',
view_args=view_args, patches=patches)
context.update({
'patch_user': user,