@@ -112,8 +112,8 @@ class UserProfile(models.Model):
def sync_person(self):
pass
- def n_todo_patches(self):
- return self.todo_patches().count()
+ def n_todo(self):
+ return self.todo_patches().count() + self.todo_series().count()
def todo_patches(self, project = None):
@@ -130,6 +130,16 @@ class UserProfile(models.Model):
.values('pk').query)
return qs
+ def todo_series(self, project = None):
+ # filter on project, if necessary
+ if project:
+ qs = Series.objects.filter(project = project)
+ else:
+ qs = Series.objects
+
+ qs = qs.filter(reviewer = self.user)
+ return qs
+
def __unicode__(self):
return self.name()
@@ -25,10 +25,10 @@ Contributor to
<div class="leftcol">
<div class="box">
<h2>Todo</h2>
-{% if user.profile.n_todo_patches %}
+{% if user.profile.n_todo %}
<p>Your <a href="{% url 'patchwork.views.user.todo_lists' %}">todo
- list</a> contains {{ user.profile.n_todo_patches }}
- patch{{ user.profile.n_todo_patches|pluralize:"es" }}.</p>
+ list</a> contains {{ user.profile.n_todo }}
+ patch{{ user.profile.n_todo|pluralize:"es" }}.</p>
{% else %}
<p>Your todo list contains patches that have been delegated to you. You
have no items in your todo list at present.</p>
@@ -5,13 +5,27 @@
{% block title %}{{ user }}'s todo list{% endblock %}
{% block heading %}{{user}}'s todo list for {{ project.linkname }}{% endblock %}
+{% block headers %}
+<script language="JavaScript" type="text/javascript">
+$(function () {
+ pw.setup_series_list('#serieslist', '/api/1.0/self/reviews/');
+});
+</script>
+{% endblock %}
+
{% block body %}
-<p>A Patchwork Todo-list contains patches that are assigned to you, and
-are in an "action required" state
+<p>A Patchwork Todo-list contains series and patches that are assigned to you,
+and are in an "action required" state
({% for state in action_required_states %}{% if forloop.last and not forloop.first %} or {% endif %}{{ state }}{% if not forloop.last and not forloop.first %}, {%endif %}{% endfor %}), and are not archived.
</p>
+<h2>Series</h2>
+
+{% include "patchwork/series-list-table.html" %}
+
+<h2>Patches</h2>
+
{% include "patchwork/patch-list.html" %}
{% endblock %}
@@ -18,7 +18,7 @@
<td><a
href="{% url 'patchwork.views.user.todo_list' project_id=todo_list.project.linkname %}"
>{{ todo_list.project.name }}</a></td>
- <td class="numberformat">{{ todo_list.n_patches }}</td>
+ <td class="numberformat">{{ todo_list.n_items }}</td>
</tr>
{% endfor %}
</table>
@@ -185,10 +185,13 @@ def todo_lists(request):
for project in Project.objects.all():
patches = request.user.profile.todo_patches(project = project)
- if not patches.count():
+ series = request.user.profile.todo_series(project=project)
+
+ n_items = patches.count() + series.count()
+ if not n_items:
continue
- todo_lists.append({'project': project, 'n_patches': patches.count()})
+ todo_lists.append({'project': project, 'n_items': n_items})
if len(todo_lists) == 1:
return todo_list(request, todo_lists[0]['project'].linkname)
@@ -59,7 +59,7 @@
{% endif %}
{% if user.is_authenticated %}
<li><a href="{% url 'patchwork.views.user.todo_lists' %}">Todo
- <span class="badge">{{ user.profile.n_todo_patches }}</span></a>
+ <span class="badge">{{ user.profile.n_todo }}</span></a>
</li>
<li><a href="{% url 'patchwork.views.bundle.bundles' %}">Bundles</a></li>
{% if user.is_staff %}
Because Series object have a reviewer field, they are part of the list of things to be on to TODO list, along with the patches where the user is a delegate. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- patchwork/models.py | 14 ++++++++++++-- patchwork/templates/patchwork/profile.html | 6 +++--- patchwork/templates/patchwork/todo-list.html | 18 ++++++++++++++++-- patchwork/templates/patchwork/todo-lists.html | 2 +- patchwork/views/user.py | 7 +++++-- templates/base.html | 2 +- 6 files changed, 38 insertions(+), 11 deletions(-)