Django 2.0 compatibility (requirement)

- URLs to path() style
- Misc updates
- Namespaces all URL references
- Removes dependency on AutoSlugField
- Cleaner reversals
- Cleaner docstrings
This commit is contained in:
Scot Hacker 2018-02-03 00:09:23 -08:00
parent 238e39085d
commit 90c41d1f29
13 changed files with 92 additions and 96 deletions

View file

@ -23,7 +23,7 @@
<p><input type="submit" name="delete-confirm" value="Do it! &rarr;" class="todo-button"> </p>
</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>
{% else %}
<p>Sorry, you don't have permission to delete lists. Please contact your group administrator.</p>

View file

@ -14,7 +14,7 @@ Note: {{ task.note }}
Task details/comments:
http://{{ site }}{% url 'todo-task_detail' task.id %}
http://{{ site }}{% url 'todo:task_detail' task.id %}
List {{ task.list.name }}:
http://{{ site }}{% url 'todo-incomplete_tasks' task.list.id task.list.slug %}
http://{{ site }}{% url 'todo:incomplete_tasks' task.list.id task.list.slug %}

View file

@ -9,8 +9,8 @@ Comment:
{% endautoescape %}
Task details/comments:
https://{{ site }}{% url 'todo-task_detail' task.id %}
https://{{ site }}{% url 'todo:task_detail' task.id %}
List {{ task.list.name }}:
https://{{ site }}{% url 'todo-incomplete_tasks' task.list.id task.list.slug %}
https://{{ site }}{% url 'todo:incomplete_tasks' task.list.id task.list.slug %}

View file

@ -14,11 +14,14 @@
<h3>{{ group.grouper }}</h3>
<ul>
{% 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 %}
</ul>
{% endfor %}
<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 %}

View file

@ -11,9 +11,9 @@
<h2>{{found_items.count}} search results for term: "{{ query_string }}"</h2>
<div class="post_list">
{% 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">
On list: <a href="{% url 'todo-incomplete_tasks' f.list.id f.list.slug %}">{{ f.list.name }}</a><br />
On list: <a href="{% url 'todo:incomplete_tasks' f.list.id f.list.slug %}">{{ f.list.name }}</a><br />
Assigned to: {% if f.assigned_to %}{{ f.assigned_to }}{% else %}Anyone{% endif %} (created by: {{ f.created_by }})<br />
Complete: {{ f.completed|yesno:"Yes,No" }}
</span>

View file

@ -9,7 +9,7 @@
// 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.
$.post("{% url 'todo-reorder_tasks' %}", data, "json");
$.post("{% url 'todo:reorder_tasks' %}", data, "json");
return false;
};
@ -98,7 +98,7 @@
{% for task in task_list %}
<tr id="{{ task.id }}">
<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>
{% if task.overdue_status %}<span class="overdue">{% endif %}
@ -110,7 +110,7 @@
<td style="text-align:center;">{% if task.note %}&asymp;{% endif %} </td>
<td style="text-align:center;">{% if task.comment_set.all.count != 0 %}{{ task.comment_set.all.count }}{% endif %}</td>
{% if 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>
{% endif %}
<td><input type="checkbox" name="del_tasks" value="{{ task.id }}" id="del_task_{{ task.id }}"> </td>
</tr>
@ -118,7 +118,7 @@
</table>
<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>
{% else %}
@ -141,7 +141,7 @@
{% for task in completed_list %}
<tr>
<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.completed_date|date:"m/d/Y" }}</td>
<td style="text-align:center;">{% if task.note %}&asymp;{% endif %} </td>
@ -153,12 +153,12 @@
</table>
<p><input type="submit" name="deldonetasks" value="Continue..." class="todo-button"></p>
</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>
{% endif %}
{% if user.is_staff %}
{% if 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>
{% endif %}
{% endif %}

View file

@ -26,7 +26,7 @@
<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 />
<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> {% if task.assigned_to %}{{ task.assigned_to.get_full_name }}{% else %}Anyone{% endif %}<br />
<strong>Created by:</strong> {{ task.created_by.first_name }} {{ task.created_by.last_name }}<br />
<strong>Due date:</strong> {{ task.due_date }}<br />