Commit 492485df authored by Arkadiusz Hiler's avatar Arkadiusz Hiler
Browse files

urls: Use named URLs



Using the quoted doted path to the view callable object
(e.g. 'patchwork.views.projects') is going to be deprecated soon.
Using either the actual callable or a named URL is recommended.

Let future-proof urls.py by using the actual callables there and
name all the URLs, so we can use the names everywhere else.
Signed-off-by: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent f5869cb5
......@@ -391,7 +391,7 @@ class Patch(models.Model):
@models.permalink
def get_absolute_url(self):
return ('patchwork.views.patch.patch', (), {'patch_id': self.id})
return ('patch', (), {'patch_id': self.id})
def __str__(self):
return self.name
......@@ -467,7 +467,7 @@ class Bundle(models.Model):
return None
site = Site.objects.get_current()
return 'http://%s%s' % (site.domain,
reverse('patchwork.views.bundle.bundle',
reverse('bundle',
kwargs={
'username': self.owner.username,
'bundlename': self.name
......@@ -475,7 +475,7 @@ class Bundle(models.Model):
@models.permalink
def get_absolute_url(self):
return ('patchwork.views.bundle.bundle', (), {
return ('bundle', (), {
'username': self.owner.username,
'bundlename': self.name,
})
......
......@@ -3,7 +3,7 @@ Hi,
This email is to confirm your account on the patchwork patch-tracking
system. You can activate your account by visiting the url:
http://{{site.domain}}{% url 'patchwork.views.confirm' key=confirmation.key %}
http://{{site.domain}}{% url 'confirm' key=confirmation.key %}
If you didn't request a user account on patchwork, then you can ignore
this mail.
......
......@@ -14,7 +14,7 @@
<p>This bundle contains patches for the {{ bundle.project.linkname }}
project.</p>
<p><a href="{% url 'patchwork.views.bundle.mbox' username=bundle.owner.username bundlename=bundle.name %}">Download bundle as mbox</a></p>
<p><a href="{% url 'bundle_mbox' username=bundle.owner.username bundlename=bundle.name %}">Download bundle as mbox</a></p>
{% if bundleform %}
<form method="post">
......
......@@ -29,7 +29,7 @@
</td>
<td style="text-align: right">{{ bundle.n_patches }}</td>
<td style="text-align: center;"><a
href="{% url 'patchwork.views.bundle.mbox' username=bundle.owner.username bundlename=bundle.name %}"
href="{% url 'bundle_mbox' username=bundle.owner.username bundlename=bundle.name %}"
><img src="{% static "images/16-em-down.png" %}" width="16" height="16" alt="download"
title="download"/></a></td>
<td style="text-align: center;">
......
......@@ -11,13 +11,13 @@ and applying patches.</p>
<p>To use pwclient, you will need:</p>
<ul>
<li>The <a href="{% url 'patchwork.views.pwclient' %}">pwclient</a>
<li>The <a href="{% url 'pwclient' %}">pwclient</a>
program (11kB, python script)</li>
<li>(optional) a <code>.pwclientrc</code> file in your home directory.</li>
</ul>
<p>You can create your own <code>.pwclientrc</code> file. Each
<a href="{% url 'patchwork.views.projects' %}">Patchwork project</a>
<a href="{% url 'root' %}">Patchwork project</a>
provides a sample linked from the 'project info' page.</p>
{% endblock %}
......@@ -29,7 +29,7 @@
<input type="submit" value="Login"/>
</td>
<td class="submitrow">
<a href="{% url 'django.contrib.auth.views.password_reset' %}">
<a href="{% url 'password_reset' %}">
Forgot password?
</a>
</td>
......
......@@ -13,7 +13,7 @@
<td>Patchwork <strong>may not</strong> send automated notifications to
this address.</td>
<td>
<form method="post" action="{% url 'patchwork.views.mail.optin' %}">
<form method="post" action="{% url 'mail_optin' %}">
{% csrf_token %}
<input type="hidden" name="email" value="{{email}}"/>
<input type="submit" value="Opt-in"/>
......@@ -24,7 +24,7 @@
<td>Patchwork <strong>may</strong> send automated notifications to
this address.</td>
<td>
<form method="post" action="{% url 'patchwork.views.mail.optout' %}">
<form method="post" action="{% url 'mail_optout' %}">
{% csrf_token %}
<input type="hidden" name="email" value="{{email}}"/>
<input type="submit" value="Opt-out"/>
......
......@@ -43,7 +43,7 @@ without your consent.</p>
{% endif %}
{% if user.is_authenticated %}
<p>Return to your <a href="{% url 'patchwork.views.user.profile' %}">user
<p>Return to your <a href="{% url 'user' %}">user
profile</a>.</p>
{% endif %}
......
......@@ -5,7 +5,7 @@ email from the Patchwork system at {{site.domain}}.
To complete the opt-in process, visit:
http://{{site.domain}}{% url 'patchwork.views.confirm' key=confirmation.key %}
http://{{site.domain}}{% url 'confirm' key=confirmation.key %}
If you didn't request this opt-in, you don't need to do anything.
......
......@@ -9,11 +9,11 @@
automated email from this Patchwork system, using the address
<strong>{{email}}</strong>.</p>
<p>If you later decide that you no longer want to receive automated mail from
Patchwork, just visit <a href="{% url 'patchwork.views.mail.settings' %}"
>http://{{site.domain}}{% url 'patchwork.views.mail.settings' %}</a>, or
Patchwork, just visit <a href="{% url 'mail_settings' %}"
>http://{{site.domain}}{% url 'mail_settings' %}</a>, or
visit the main Patchwork page and navigate from there.</p>
{% if user.is_authenticated %}
<p>Return to your <a href="{% url 'patchwork.views.user.profile' %}">user
<p>Return to your <a href="{% url 'user' %}">user
profile</a>.</p>
{% endif %}
{% endblock %}
......@@ -44,7 +44,7 @@ without your consent.</p>
{% endif %}
{% if user.is_authenticated %}
<p>Return to your <a href="{% url 'patchwork.views.user.profile' %}">user
<p>Return to your <a href="{% url 'user' %}">user
profile</a>.</p>
{% endif %}
......
......@@ -5,7 +5,7 @@ from the Patchwork system at {{site.domain}}.
To complete the opt-out process, visit:
http://{{site.domain}}{% url 'patchwork.views.confirm' key=confirmation.key %}
http://{{site.domain}}{% url 'confirm' key=confirmation.key %}
If you didn't request this opt-out, you don't need to do anything.
......
......@@ -12,11 +12,11 @@ automated notifications from this Patchwork system, from the address
different sites, as they are run independently. You may need to opt-out of
those separately.</p>
<p>If you later decide to receive mail from Patchwork, just visit
<a href="{% url 'patchwork.views.mail.settings' %}"
>http://{{site.domain}}{% url 'patchwork.views.mail.settings' %}</a>, or
<a href="{% url 'mail_settings' %}"
>http://{{site.domain}}{% url 'mail_settings' %}</a>, or
visit the main Patchwork page and navigate from there.</p>
{% if user.is_authenticated %}
<p>Return to your <a href="{% url 'patchwork.views.user.profile' %}">user
<p>Return to your <a href="{% url 'user' %}">user
profile</a>.</p>
{% endif %}
{% endblock %}
......@@ -17,4 +17,4 @@ Happy patchworking.
This is an automated mail sent by the Patchwork system at
{{site.domain}}. To stop receiving these notifications, edit
your mail settings at:
http://{{site.domain}}{% url 'patchwork.views.mail.settings' %}
http://{{site.domain}}{% url 'mail_settings' %}
......@@ -151,7 +151,7 @@ $(document).ready(function() {
<input type="checkbox" name="patch_id:{{patch.id}}"/>
</td>
{% endif %}
<td><a href="{% url 'patchwork.views.patch.patch' patch_id=patch.id %}"
<td><a href="{% url 'patch' patch_id=patch.id %}"
>{{ patch.name|default:"[no subject]"|truncatechars:100 }}</a></td>
{% for tag in project.tags %}
{{ patch|patch_tags:tag }}
......
......@@ -196,11 +196,11 @@ function toggle_headers(link_id, headers_id)
<a href="javascript:toggle_headers('hide-patch', 'patch')" id="hide-patch">hide</a></span>
{% if patch.content %}
<span>|</span>
<a href="{% url 'patchwork.views.patch.content' patch_id=patch.id %}"
<a href="{% url 'patch_content' patch_id=patch.id %}"
>download patch</a>
{% endif %}
<span>|</span>
<a href="{% url 'patchwork.views.patch.mbox' patch_id=patch.id %}"
<a href="{% url 'patch_mbox' patch_id=patch.id %}"
>download mbox</a>
</h2>
<div id="patch" class="patch">
......
......@@ -11,14 +11,14 @@
{% if user.profile.maintainer_projects.count %}
Maintainer of
{% for project in user.profile.maintainer_projects.all %}
<a href="{% url 'patchwork.views.patch.list' project_id=project.linkname %}"
<a href="{% url 'patch_list' project_id=project.linkname %}"
>{{ project.linkname }}</a>{% if not forloop.last %},{% endif %}{% endfor %}.
{% endif %}
{% if user.profile.contributor_projects.count %}
Contributor to
{% for project in user.profile.contributor_projects.all %}
<a href="{% url 'patchwork.views.patch.list' project_id=project.linkname %}"
<a href="{% url 'patch_list' project_id=project.linkname %}"
>{{ project.linkname }}</a>{% if not forloop.last %},{% endif %}{% endfor %}.
{% endif %}
</p>
......@@ -27,7 +27,7 @@ Contributor to
<div class="box">
<h2>Todo</h2>
{% if user.profile.n_todo %}
<p>Your <a href="{% url 'patchwork.views.user.todo_lists' %}">todo
<p>Your <a href="{% url 'todo_lists' %}">todo
list</a> contains {{ user.profile.n_todo }}
item{{ user.profile.n_todo|pluralize:"s" }}.</p>
{% else %}
......@@ -57,7 +57,7 @@ address.</p>
<td>{{ email.email }}</td>
<td>
{% ifnotequal user.email email.email %}
<form action="{% url 'patchwork.views.user.unlink' person_id=email.id %}"
<form action="{% url 'user_unlink' person_id=email.id %}"
method="post">
{% csrf_token %}
<input type="submit" value="Unlink"/>
......@@ -66,14 +66,14 @@ address.</p>
</td>
<td>
{% if email.is_optout %}
<form method="post" action="{% url 'patchwork.views.mail.optin' %}">
<form method="post" action="{% url 'mail_optin' %}">
No,
{% csrf_token %}
<input type="hidden" name="email" value="{{email.email}}"/>
<input type="submit" value="Opt-in"/>
</form>
{% else %}
<form method="post" action="{% url 'patchwork.views.mail.optout' %}">
<form method="post" action="{% url 'mail_optout' %}">
Yes,
{% csrf_token %}
<input type="hidden" name="email" value="{{email.email}}"/>
......@@ -85,7 +85,7 @@ address.</p>
{% endfor %}
<tr>
<td colspan="3">
<form action="{% url 'patchwork.views.user.link' %}" method="post">
<form action="{% url 'user_link' %}" method="post">
{% csrf_token %}
{{ linkform.email }}
<input type="submit" value="Add"/>
......@@ -108,7 +108,7 @@ address.</p>
<li><a href="{{ bundle.get_absolute_url }}">{{ bundle.name }}</a></li>
{% endfor %}
</ul>
<p>Visit the <a href="{%url 'patchwork.views.bundle.bundles' %}">bundles
<p>Visit the <a href="{%url 'bundle_list' %}">bundles
page</a> to manage your bundles.</p>
{% else %}
<p>You have no bundles.</p>
......@@ -135,7 +135,7 @@ address.</p>
<div class="box">
<h2>Authentication</h2>
<a href="{% url 'django.contrib.auth.views.password_change' %}">Change password</a>
<a href="{% url 'password_change' %}">Change password</a>
</div>
</div>
......
......@@ -54,9 +54,9 @@
</table>
{% if settings.ENABLE_XMLRPC %}
<p>Sample <a href="{% url 'patchwork.views.help' "pwclient/" %}">Patchwork
<p>Sample <a href="{% url 'help' "pwclient/" %}">Patchwork
client</a> configuration for this project: <a
href="{% url 'patchwork.views.pwclientrc' project.linkname %}"
href="{% url 'pwclientrc' project.linkname %}"
>.pwclientrc</a>.</p>
{% endif %}
......
......@@ -4,7 +4,7 @@
{% block navbarmenu %}
<ul class="nav navbar-nav">
<li class="active">
<a href="{% url 'patchwork.views.projects' %}">
<a href="{% url 'root' %}">
<span class="glyphicon glyphicon-home"></span>
All projects</a>
</li>
......
......@@ -8,7 +8,7 @@
# default={{ project.linkname }}
[{{ project.linkname }}]
url= {{scheme}}://{{site.domain}}{% url 'patchwork.views.xmlrpc.xmlrpc' %}
url= {{scheme}}://{{site.domain}}{% url 'xmlrpc' %}
{% if user.is_authenticated %}
username: {{ user.username }}
password: <add your patchwork password here>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment