Named URL tweaks for Django 1.5 compatibility

This commit is contained in:
Scot Hacker 2013-08-31 09:55:19 -07:00
parent a1703b3127
commit e77176bc4f
6 changed files with 15 additions and 16 deletions

View file

@ -12,7 +12,7 @@
<p> {{ list.name }} is gone.</p> <p> {{ list.name }} is gone.</p>
<a href="{% url todo-lists %}">Return to lists</a> <a href="{% url 'todo-lists' %}">Return to lists</a>
{% else %} {% else %}
@ -36,7 +36,7 @@
</form> </form>
<a href="{% url todo-incomplete_tasks list.id list_slug %}">Return to list: {{ list.name }}</a> <a href="{% url 'todo-incomplete_tasks' list.id list_slug %}">Return to list: {{ list.name }}</a>
{% endif %} {% endif %}

View file

@ -23,7 +23,7 @@
<h3>{{ group.grouper }}</h3> <h3>{{ group.grouper }}</h3>
<ul> <ul>
{% for item in group.list %} {% for item in group.list %}
<li><a class="todo" href="{% url todo-incomplete_tasks item.id item.slug %}">{{ item.name }} </a> ({{ item.incomplete_tasks.count }}/{{ item.item_set.count }})</li> <li><a class="todo" href="{% url 'todo-incomplete_tasks' item.id item.slug %}">{{ item.name }} </a> ({{ item.incomplete_tasks.count }}/{{ item.item_set.count }})</li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -35,6 +35,6 @@
&nbsp; &nbsp;
</div> </div>
<p><a href="{% url todo-add_list %}">Create new todo list</a></p> <p><a href="{% url 'todo-add_list' %}">Create new todo list</a></p>
{% endblock %} {% endblock %}

View file

@ -20,10 +20,10 @@
<div class="post_list"> <div class="post_list">
{% for f in found_items %} {% for f in found_items %}
<p><strong><a href="{% url todo-task_detail f.id %}">{{ f.title }}</a></strong><br /> <p><strong><a href="{% url 'todo-task_detail' f.id %}">{{ f.title }}</a></strong><br />
<span class="minor"> <span class="minor">
On list: <a href="{% url todo-incomplete_tasks f.list.id f.list.slug %}">{{ f.list }}</a><br /> On list: <a href="{% url 'todo-incomplete_tasks' f.list.id f.list.slug %}">{{ f.list }}</a><br />
Assigned to: {{ f.assigned_to }} (created by: {{ f.created_by }})<br /> Assigned to: {{ f.assigned_to }} (created by: {{ f.created_by }})<br />
Complete: {{ f.completed|yesno:"Yes,No" }} Complete: {{ f.completed|yesno:"Yes,No" }}
</span> </span>

View file

@ -11,7 +11,7 @@ function order_tasks(data) {
// data in a list. We pass that list as an object called "data" to a Django view // data in a list. We pass that list as an object called "data" to a Django view
// to save the re-ordered data into the database. // to save the re-ordered data into the database.
$.post("{% url todo-reorder_tasks %}", data, "json"); $.post("{% url 'todo-reorder_tasks' %}", data, "json");
return false; return false;
}; };
@ -118,7 +118,7 @@ $(document).ready(function() {
{% for task in task_list %} {% for task in task_list %}
<tr class="{% cycle 'row1' 'row2' %}" id="{{ task.id }}"> <tr class="{% cycle 'row1' 'row2' %}" id="{{ task.id }}">
<td><input type="checkbox" name="mark_done" value="{{ task.id }}" id="mark_done_{{ task.id }}"> </td> <td><input type="checkbox" name="mark_done" value="{{ task.id }}" id="mark_done_{{ task.id }}"> </td>
<td><a href="{% url todo-task_detail task.id %}">{{ task.title|truncatewords:20 }}</a></td> <td><a href="{% url 'todo-task_detail' task.id %}">{{ task.title|truncatewords:20 }}</a></td>
<td>{{ task.created_date|date:"m/d/Y" }}</td> <td>{{ task.created_date|date:"m/d/Y" }}</td>
<td> <td>
{% if task.overdue_status %}<span class="overdue">{% endif %} {% if task.overdue_status %}<span class="overdue">{% endif %}
@ -132,7 +132,7 @@ $(document).ready(function() {
</td> </td>
{% ifequal list_slug "mine" %} {% ifequal list_slug "mine" %}
<td><a href="{% url todo-incomplete_tasks task.list.id task.list.slug %}">{{ task.list }}</a></td> <td><a href="{% url 'todo-incomplete_tasks' task.list.id task.list.slug %}">{{ task.list }}</a></td>
{% endifequal %} {% endifequal %}
<td><input type="checkbox" name="del_task" value="{{ task.id }}" id="del_task_{{ task.id }}"> </td> <td><input type="checkbox" name="del_task" value="{{ task.id }}" id="del_task_{{ task.id }}"> </td>
@ -141,7 +141,7 @@ $(document).ready(function() {
</table> </table>
<p><input type="submit" name="mark_tasks_done" value="Continue..." class="todo-button"></p> <p><input type="submit" name="mark_tasks_done" value="Continue..." class="todo-button"></p>
<p><a class="todo" href="{% url todo-completed_tasks list_id list_slug %}">View completed tasks</a></p> <p><a class="todo" href="{% url 'todo-completed_tasks' list_id list_slug %}">View completed tasks</a></p>
{% endifequal %} {% endifequal %}
{% ifequal view_completed 1 %} {% ifequal view_completed 1 %}
@ -165,7 +165,7 @@ $(document).ready(function() {
{% for task in completed_list %} {% for task in completed_list %}
<tr class="{% cycle 'row1' 'row2' %}"> <tr class="{% cycle 'row1' 'row2' %}">
<td><input type="checkbox" name="undo_completed_task" value="{{ task.id }}" id="id_undo_completed_task{{ task.id }}"> </td> <td><input type="checkbox" name="undo_completed_task" value="{{ task.id }}" id="id_undo_completed_task{{ task.id }}"> </td>
<td><a href="{% url todo-task_detail task.id %}">{{ task.title|truncatewords:20 }}</a></td> <td><a href="{% url 'todo-task_detail' task.id %}">{{ task.title|truncatewords:20 }}</a></td>
<td>{{ task.created_date|date:"m/d/Y" }}</td> <td>{{ task.created_date|date:"m/d/Y" }}</td>
<td>{{ task.completed_date|date:"m/d/Y" }}</td> <td>{{ task.completed_date|date:"m/d/Y" }}</td>
<td style="text-align:center;">{% if task.note %}&asymp;{% endif %} </td> <td style="text-align:center;">{% if task.note %}&asymp;{% endif %} </td>
@ -178,12 +178,12 @@ $(document).ready(function() {
</table> </table>
<p><input type="submit" name="deldonetasks" value="Continue..." class="todo-button"></p> <p><input type="submit" name="deldonetasks" value="Continue..." class="todo-button"></p>
</form> </form>
<p><a class="todo" href="{% url todo-incomplete_tasks list_id list_slug %}">View incomplete tasks</a></p> <p><a class="todo" href="{% url 'todo-incomplete_tasks' list_id list_slug %}">View incomplete tasks</a></p>
{% endifequal %} {% endifequal %}
{% ifequal can_del 1 %} {% ifequal can_del 1 %}
{% ifnotequal list_slug "mine" %} {% ifnotequal list_slug "mine" %}
<p><a class="todo" href="{% url todo-del_list list_id list_slug %}">Delete this list</a></p> <p><a class="todo" href="{% url 'todo-del_list' list_id list_slug %}">Delete this list</a></p>
{% endifnotequal %} {% endifnotequal %}
{% endifequal %} {% endifequal %}

View file

@ -35,7 +35,7 @@ $(document).ready(function() {
{% csrf_token %} {% csrf_token %}
<p id="slideToggle" ><strong>&rarr; Click to edit details &larr;</strong></p> <p id="slideToggle" ><strong>&rarr; Click to edit details &larr;</strong></p>
<p><strong>In list:</strong> <a href="{% url todo-incomplete_tasks task.list.id task.list.slug %}" class="showlink">{{ task.list }}</a><br /> <p><strong>In list:</strong> <a href="{% url 'todo-incomplete_tasks' task.list.id task.list.slug %}" class="showlink">{{ task.list }}</a><br />
<strong>Assigned to:</strong> {{ task.assigned_to.first_name }} {{ task.assigned_to.last_name }}<br /> <strong>Assigned to:</strong> {{ task.assigned_to.first_name }} {{ task.assigned_to.last_name }}<br />
<strong>Created by:</strong> {{ task.created_by.first_name }} {{ task.created_by.last_name }}<br /> <strong>Created by:</strong> {{ task.created_by.first_name }} {{ task.created_by.last_name }}<br />
<strong>Due date:</strong> {{ task.due_date }}<br /> <strong>Due date:</strong> {{ task.due_date }}<br />

View file

@ -1,5 +1,4 @@
from django.conf.urls.defaults import * from django.conf.urls import *
from django.views.generic.simple import direct_to_template
from django.contrib.auth import views as auth_views from django.contrib.auth import views as auth_views
urlpatterns = patterns('', urlpatterns = patterns('',