mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Add "used on" column on Task index, edit and chooser (#6186)
Co-authored-by: Dan Braghis <dan.braghis@torchbox.com>
This commit is contained in:
parent
722c8eff56
commit
03f728c67d
@ -33,6 +33,16 @@
|
||||
{{ field }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<li>
|
||||
<div class="help-block help-info">
|
||||
{% for workflow in object.workflows %}
|
||||
{% if forloop.first %}<strong>{% trans "Used on" %}:</strong> {% endif %}
|
||||
<a href="{% url 'wagtailadmin_workflows:edit' workflow.pk %}">{{ workflow.name }}</a>{% if not forloop.last %}, {% endif %}
|
||||
{% empty %}
|
||||
{% trans "Not used" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% block footer %}
|
||||
|
@ -25,6 +25,9 @@
|
||||
{% trans "Task type" %}
|
||||
</th>
|
||||
{% endif %}
|
||||
<th>
|
||||
{% trans "Used on" %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -40,6 +43,16 @@
|
||||
{{ task.content_type.name }}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td>
|
||||
{% for workflow in task.workflows|slice:":5" %}
|
||||
{{ workflow.name }}{% if not forloop.last %}, {% endif %}
|
||||
{% empty %}
|
||||
{% trans "Not used" %}
|
||||
{% endfor %}
|
||||
{% if task.workflows.count > 5 %}
|
||||
{% blocktrans count counter=task.workflows.count|add:-5 %}+{{ counter }} more{% plural %}+{{ counter }} more{% endblocktrans %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
@ -34,6 +34,9 @@
|
||||
<th>
|
||||
{% trans "Type" %}
|
||||
</th>
|
||||
<th>
|
||||
{% trans "Used on" %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -50,6 +53,16 @@
|
||||
<td>
|
||||
{{ task.specific.get_verbose_name }}
|
||||
</td>
|
||||
<td>
|
||||
{% for workflow in task.workflows|slice:":5" %}
|
||||
<a href="{% url 'wagtailadmin_workflows:edit' workflow.pk %}">{{ workflow.name }}{% if not forloop.last %}, {% endif %}</a>
|
||||
{% empty %}
|
||||
{% trans "Not used" %}
|
||||
{% endfor %}
|
||||
{% if task.workflows.count > 5 %}
|
||||
{% blocktrans count counter=task.workflows.count|add:-5 %}+{{ counter }} more{% plural %}+{{ counter }} more{% endblocktrans %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
@ -2625,6 +2625,11 @@ class Task(models.Model):
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@property
|
||||
def workflows(self):
|
||||
"""Returns all ``Workflow`` instances that use this task"""
|
||||
return Workflow.objects.filter(workflow_tasks__task=self)
|
||||
|
||||
@classmethod
|
||||
def get_verbose_name(cls):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user