Browse Source

Улучшил в плане удобочитаемости вывод задач

devel
bashmak 9 years ago
parent
commit
051c967773
  1. 13
      taskapp/locale/ru/LC_MESSAGES/django.po
  2. 33
      taskapp/templates/taskapp/tasklist.html
  3. 32
      taskapp/templates/taskapp/tasklist_active.html
  4. 33
      taskapp/templates/taskapp/tasklist_all.html
  5. 32
      taskapp/templates/taskapp/tasklist_finish.html
  6. 20
      taskapp/templates/taskapp/tasklist_own.html
  7. 5
      taskapp/templates/taskapp/view.html
  8. 6
      taskapp/views.py

13
taskapp/locale/ru/LC_MESSAGES/django.po

@ -308,7 +308,7 @@ msgstr "Задача действительна до"
#: taskapp/templates/taskapp/view.html:28 #: taskapp/templates/taskapp/view.html:28
msgid "time left" msgid "time left"
msgstr ""
msgstr "Времени осталось"
#: taskapp/templates/taskapp/view.html:29 #: taskapp/templates/taskapp/view.html:29
msgid "Task type" msgid "Task type"
@ -335,9 +335,8 @@ msgid "Error in the form fields"
msgstr "Ошибка в полях формы" msgstr "Ошибка в полях формы"
#: taskapp/views.py:151 #: taskapp/views.py:151
#, python-format
msgid "User '%s' does not exist"
msgstr ""
msgid "User does not exist"
msgstr "Абонент не найден"
msgid "Active tasks" msgid "Active tasks"
msgstr "Активные задачи" msgstr "Активные задачи"
@ -359,3 +358,9 @@ msgstr "Задачи, которые необходимо выполнить"
msgid "locality %s. Task type - %s. " msgid "locality %s. Task type - %s. "
msgstr "с. %s. Тип задачи - %s. " msgstr "с. %s. Тип задачи - %s. "
msgid "Name"
msgstr "ФИО"
msgid "Address"
msgstr "Адрес"

33
taskapp/templates/taskapp/tasklist.html

@ -7,14 +7,13 @@
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
<th class="col-sm-3">{% trans 'Name' %}</th>
<th class="col-sm-1">{% trans 'Address' %}</th>
<th class="col-sm-1">{% trans 'The nature of the damage' %}</th>
<th class="col-sm-4">{% trans 'Description' %}</th> <th class="col-sm-4">{% trans 'Description' %}</th>
<th class="col-sm-1">{% trans 'Task author' %}</th> <th class="col-sm-1">{% trans 'Task author' %}</th>
<th class="col-sm-1">{% trans 'The nature of the damage' %}</th>
<th class="col-sm-1">{% trans 'Condition' %}</th>
<th class="col-sm-1">{% trans 'A priority' %}</th>
<th class="col-sm-1">{% trans 'Date of create' %}</th> <th class="col-sm-1">{% trans 'Date of create' %}</th>
<th class="col-sm-1">{% trans 'Attachment' %}</th>
<th class="col-sm-2" colspan="3">{% trans 'Actions' %}</th>
<th class="col-sm-1">{% trans 'Actions' %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -35,14 +34,22 @@
{% endif %} {% endif %}
<td><a href="{% url 'taskapp:view' task.id %}" target="_blank">{{ task.id }}</a></td> <td><a href="{% url 'taskapp:view' task.id %}" target="_blank">{{ task.id }}</a></td>
<td>{{ task.descr }}</td>
<td><a href="{% url 'acc_app:other_profile' task.author.id %}" title="{{ task.author.get_full_name }}">{{ task.author.username }}</a></td>
{% if task.abon and task.abon.group %}
<td><a href="{% url 'abonapp:abon_home' task.abon.group.pk task.abon.pk %}" target="_blank">{{ task.abon.get_full_name }}</a></td>
<td>{{ task.abon.street|default:_('Not assigned') }} {{ task.abon.house|default:_('Not assigned') }}</td>
{% else %}
<td>{% trans 'User does not exist' %}</td>
<td>---</td>
{% endif %}
<td>{{ task.get_mode_display }}</td> <td>{{ task.get_mode_display }}</td>
<td>{{ task.get_state_display }}</td>
<td>{{ task.get_priority_display }}</td>
<td>{{ task.descr }}</td>
<td><a href="{% url 'acc_app:other_profile' task.author.pk %}"
title="{{ task.author.get_full_name }}">{{ task.author.username }}</a></td>
<td>{{ task.time_of_create|date:'d N Y H:i:s' }}</td> <td>{{ task.time_of_create|date:'d N Y H:i:s' }}</td>
<td>{% if task.attachment %}<a href="{{ task.attachment.url }}" target="_blank">{{ task.get_attachment_fname|truncatechars:32|truncatechars:32 }}</a>{% else %}&horbar;{% endif %}</td>
<td colspan="3" class="btn-group btn-group-justified">
<td class="btn-group btn-group-justified">
<a href="{% url 'taskapp:begin' task.id %}" class="btn btn-primary btn-xs" title="{% trans 'Begin' %}"> <a href="{% url 'taskapp:begin' task.id %}" class="btn btn-primary btn-xs" title="{% trans 'Begin' %}">
<span class="glyphicon glyphicon-cog"></span> <span class="glyphicon glyphicon-cog"></span>
</a> </a>
@ -58,13 +65,13 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<td colspan="11">{% trans 'The list is empty' %}</td>
<td colspan="8">{% trans 'The list is empty' %}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="11">
<td colspan="8">
{% include 'taskapp/footer_btns.html' %} {% include 'taskapp/footer_btns.html' %}
</td> </td>
</tr> </tr>

32
taskapp/templates/taskapp/tasklist_active.html

@ -7,14 +7,13 @@
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
<th class="col-sm-3">{% trans 'Name' %}</th>
<th class="col-sm-1">{% trans 'Address' %}</th>
<th class="col-sm-1">{% trans 'The nature of the damage' %}</th>
<th class="col-sm-4">{% trans 'Description' %}</th> <th class="col-sm-4">{% trans 'Description' %}</th>
<th class="col-sm-1">{% trans 'Task author' %}</th> <th class="col-sm-1">{% trans 'Task author' %}</th>
<th class="col-sm-1">{% trans 'The nature of the damage' %}</th>
<th class="col-sm-1">{% trans 'Condition' %}</th>
<th class="col-sm-1">{% trans 'A priority' %}</th>
<th class="col-sm-1">{% trans 'Date of create' %}</th> <th class="col-sm-1">{% trans 'Date of create' %}</th>
<th class="col-sm-1">{% trans 'Attachment' %}</th>
<th class="col-sm-2" colspan="3">{% trans 'Actions' %}</th>
<th class="col-sm-1">{% trans 'Actions' %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -35,15 +34,22 @@
{% endif %} {% endif %}
<td><a href="{% url 'taskapp:view' task.id %}" target="_blank">{{ task.id }}</a></td> <td><a href="{% url 'taskapp:view' task.id %}" target="_blank">{{ task.id }}</a></td>
{% if task.abon and task.abon.group %}
<td><a href="{% url 'abonapp:abon_home' task.abon.group.pk task.abon.pk %}" target="_blank">{{ task.abon.get_full_name }}</a></td>
<td>{{ task.abon.street|default:_('Not assigned') }} {{ task.abon.house|default:_('Not assigned') }}</td>
{% else %}
<td>{% trans 'User does not exist' %}</td>
<td>---</td>
{% endif %}
<td>{{ task.get_mode_display }}</td>
<td>{{ task.descr }}</td> <td>{{ task.descr }}</td>
<td><a href="{% url 'acc_app:other_profile' task.author.id %}"
<td><a href="{% url 'acc_app:other_profile' task.author.pk %}"
title="{{ task.author.get_full_name }}">{{ task.author.username }}</a></td> title="{{ task.author.get_full_name }}">{{ task.author.username }}</a></td>
<td>{{ task.get_mode_display }}</td>
<td>{{ task.get_state_display }}</td>
<td>{{ task.get_priority_display }}</td>
<td>{{ task.time_of_create|date:'d N Y H:i:s' }}</td> <td>{{ task.time_of_create|date:'d N Y H:i:s' }}</td>
<td>{% if task.attachment %}<a href="{{ task.attachment.url }}" target="_blank">{{ task.get_attachment_fname|truncatechars:32 }}</a>{% else %}&horbar;{% endif %}</td>
<td colspan="3" class="btn-group">
<td class="btn-group">
<a href="{% url 'taskapp:finish' task.id %}" class="btn btn-sm btn-success" title="{% trans 'Complete' %}"> <a href="{% url 'taskapp:finish' task.id %}" class="btn btn-sm btn-success" title="{% trans 'Complete' %}">
<span class="glyphicon glyphicon-ok"></span> <span class="glyphicon glyphicon-ok"></span>
</a> </a>
@ -56,13 +62,13 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<td colspan="11">{% trans 'The list is empty' %}</td>
<td colspan="8">{% trans 'The list is empty' %}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="11">
<td colspan="8">
{% include 'taskapp/footer_btns.html' %} {% include 'taskapp/footer_btns.html' %}
</td> </td>
</tr> </tr>

33
taskapp/templates/taskapp/tasklist_all.html

@ -19,14 +19,14 @@
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
<th class="col-sm-4">{% trans 'Description' %}</th>
<th class="col-sm-1">{% trans 'Task author' %}</th>
<th class="col-sm-3">{% trans 'Name' %}</th>
<th class="col-sm-1">{% trans 'Address' %}</th>
<th class="col-sm-1">{% trans 'The nature of the damage' %}</th> <th class="col-sm-1">{% trans 'The nature of the damage' %}</th>
<th class="col-sm-3">{% trans 'Description' %}</th>
<th class="col-sm-1">{% trans 'Task author' %}</th>
<th class="col-sm-1">{% trans 'Condition' %}</th> <th class="col-sm-1">{% trans 'Condition' %}</th>
<th class="col-sm-1">{% trans 'A priority' %}</th>
<th class="col-sm-1">{% trans 'Date of create' %}</th> <th class="col-sm-1">{% trans 'Date of create' %}</th>
<th class="col-sm-1">{% trans 'Attachment' %}</th>
<th class="col-sm-2" colspan="3">{% trans 'Actions' %}</th>
<th class="col-sm-1">{% trans 'Actions' %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -47,14 +47,23 @@
{% endif %} {% endif %}
<td><a href="{% url 'taskapp:view' task.id %}" target="_blank">{{ task.id }}</a></td> <td><a href="{% url 'taskapp:view' task.id %}" target="_blank">{{ task.id }}</a></td>
<td>{{ task.descr }}</td>
<td><a href="{% url 'acc_app:other_profile' task.author.id %}" title="{{ task.author.get_full_name }}">{{ task.author.username }}</a></td>
{% if task.abon and task.abon.group %}
<td><a href="{% url 'abonapp:abon_home' task.abon.group.pk task.abon.pk %}" target="_blank">{{ task.abon.get_full_name }}</a></td>
<td>{{ task.abon.street|default:_('Not assigned') }} {{ task.abon.house|default:_('Not assigned') }}</td>
{% else %}
<td>{% trans 'User does not exist' %}</td>
<td>---</td>
{% endif %}
<td>{{ task.get_mode_display }}</td> <td>{{ task.get_mode_display }}</td>
<td>{{ task.descr }}</td>
<td><a href="{% url 'acc_app:other_profile' task.author.pk %}"
title="{{ task.author.get_full_name }}">{{ task.author.username }}</a></td>
<td>{{ task.get_state_display }}</td> <td>{{ task.get_state_display }}</td>
<td>{{ task.get_priority_display }}</td>
<td>{{ task.time_of_create|date:'d N Y H:i:s' }}</td> <td>{{ task.time_of_create|date:'d N Y H:i:s' }}</td>
<td>{% if task.attachment %}<a href="{{ task.attachment.url }}" target="_blank">{{ task.get_attachment_fname|truncatechars:32 }}</a>{% else %}&horbar;{% endif %}</td>
<td colspan="3" class="btn-group btn-group-justified">
<td class="btn-group btn-group-justified">
{% if perms.taskapp.change_task %} {% if perms.taskapp.change_task %}
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-default btn-sm" title="{% trans 'Edit' %}"> <a href="{% url 'taskapp:edit' task.id %}" class="btn btn-default btn-sm" title="{% trans 'Edit' %}">
<span class="glyphicon glyphicon-edit"></span> <span class="glyphicon glyphicon-edit"></span>
@ -69,13 +78,13 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<td colspan="12">{% trans 'The list is empty' %}</td>
<td colspan="9">{% trans 'The list is empty' %}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="12">
<td colspan="9">
{% if perms.taskapp.add_task %} {% if perms.taskapp.add_task %}
<a href="{% url 'taskapp:add' %}" class="btn btn-sm btn-success" title="{% trans 'Add new task' %}"> <a href="{% url 'taskapp:add' %}" class="btn btn-sm btn-success" title="{% trans 'Add new task' %}">
<span class="glyphicon glyphicon-plus"></span> {% trans 'Add new task' %} <span class="glyphicon glyphicon-plus"></span> {% trans 'Add new task' %}

32
taskapp/templates/taskapp/tasklist_finish.html

@ -7,14 +7,13 @@
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
<th class="col-sm-3">{% trans 'Name' %}</th>
<th class="col-sm-1">{% trans 'Address' %}</th>
<th class="col-sm-1">{% trans 'The nature of the damage' %}</th>
<th class="col-sm-4">{% trans 'Description' %}</th> <th class="col-sm-4">{% trans 'Description' %}</th>
<th class="col-sm-1">{% trans 'Task author' %}</th> <th class="col-sm-1">{% trans 'Task author' %}</th>
<th class="col-sm-1">{% trans 'The nature of the damage' %}</th>
<th class="col-sm-1">{% trans 'Condition' %}</th>
<th class="col-sm-1">{% trans 'A priority' %}</th>
<th class="col-sm-1">{% trans 'Date of create' %}</th> <th class="col-sm-1">{% trans 'Date of create' %}</th>
<th class="col-sm-1">{% trans 'Attachment' %}</th>
<th class="col-sm-2" colspan="3">{% trans 'Actions' %}</th>
<th class="col-sm-1">{% trans 'Actions' %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -35,15 +34,22 @@
{% endif %} {% endif %}
<td><a href="{% url 'taskapp:view' task.id %}" target="_blank">{{ task.id }}</a></td> <td><a href="{% url 'taskapp:view' task.id %}" target="_blank">{{ task.id }}</a></td>
{% if task.abon and task.abon.group %}
<td><a href="{% url 'abonapp:abon_home' task.abon.group.pk task.abon.pk %}" target="_blank">{{ task.abon.get_full_name }}</a></td>
<td>{{ task.abon.street|default:_('Not assigned') }} {{ task.abon.house|default:_('Not assigned') }}</td>
{% else %}
<td>{% trans 'User does not exist' %}</td>
<td>---</td>
{% endif %}
<td>{{ task.get_mode_display }}</td>
<td>{{ task.descr }}</td> <td>{{ task.descr }}</td>
<td><a href="{% url 'acc_app:other_profile' task.author.id %}"
<td><a href="{% url 'acc_app:other_profile' task.author.pk %}"
title="{{ task.author.get_full_name }}">{{ task.author.username }}</a></td> title="{{ task.author.get_full_name }}">{{ task.author.username }}</a></td>
<td>{{ task.get_mode_display }}</td>
<td>{{ task.get_state_display }}</td>
<td>{{ task.get_priority_display }}</td>
<td>{{ task.time_of_create|date:'d N Y H:i:s' }}</td> <td>{{ task.time_of_create|date:'d N Y H:i:s' }}</td>
<td>{% if task.attachment %}<a href="{{ task.attachment.url }}" target="_blank">{{ task.get_attachment_fname|truncatechars:32 }}</a>{% else %}&horbar;{% endif %}</td>
<td colspan="3" class="btn-group">
<td class="btn-group">
{% if perms.taskapp.change_task %} {% if perms.taskapp.change_task %}
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-sm btn-default" title="{% trans 'Edit' %}"> <a href="{% url 'taskapp:edit' task.id %}" class="btn btn-sm btn-default" title="{% trans 'Edit' %}">
<span class="glyphicon glyphicon-edit"></span> <span class="glyphicon glyphicon-edit"></span>
@ -58,13 +64,13 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<td colspan="11">{% trans 'The list is empty' %}</td>
<td colspan="8">{% trans 'The list is empty' %}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="11">
<td colspan="8">
{% include 'taskapp/footer_btns.html' %} {% include 'taskapp/footer_btns.html' %}
</td> </td>
</tr> </tr>

20
taskapp/templates/taskapp/tasklist_own.html

@ -7,12 +7,12 @@
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
<th class="col-sm-4">{% trans 'Description' %}</th>
<th class="col-sm-3">{% trans 'Name' %}</th>
<th class="col-sm-1">{% trans 'Address' %}</th>
<th class="col-sm-1">{% trans 'The nature of the damage' %}</th> <th class="col-sm-1">{% trans 'The nature of the damage' %}</th>
<th class="col-sm-4">{% trans 'Description' %}</th>
<th class="col-sm-1">{% trans 'Condition' %}</th> <th class="col-sm-1">{% trans 'Condition' %}</th>
<th class="col-sm-1">{% trans 'A priority' %}</th>
<th class="col-sm-1">{% trans 'Date of create' %}</th> <th class="col-sm-1">{% trans 'Date of create' %}</th>
<th class="col-sm-3">{% trans 'Attachment' %}</th>
<th class="col-sm-1">{% trans 'Actions' %}</th> <th class="col-sm-1">{% trans 'Actions' %}</th>
</tr> </tr>
</thead> </thead>
@ -34,12 +34,20 @@
{% endif %} {% endif %}
<td><a href="{% url 'taskapp:view' task.id %}" target="_blank">{{ task.id }}</a></td> <td><a href="{% url 'taskapp:view' task.id %}" target="_blank">{{ task.id }}</a></td>
<td>{{ task.descr }}</td>
{% if task.abon and task.abon.group %}
<td><a href="{% url 'abonapp:abon_home' task.abon.group.pk task.abon.pk %}" target="_blank">{{ task.abon.get_full_name }}</a></td>
<td>{{ task.abon.street|default:_('Not assigned') }} {{ task.abon.house|default:_('Not assigned') }}</td>
{% else %}
<td>{% trans 'User does not exist' %}</td>
<td>---</td>
{% endif %}
<td>{{ task.get_mode_display }}</td> <td>{{ task.get_mode_display }}</td>
<td>{{ task.descr }}</td>
<td>{{ task.get_state_display }}</td> <td>{{ task.get_state_display }}</td>
<td>{{ task.get_priority_display }}</td>
<td>{{ task.time_of_create|date:'d N Y H:i:s' }}</td> <td>{{ task.time_of_create|date:'d N Y H:i:s' }}</td>
<td>{% if task.attachment %}<a href="{{ task.attachment.url }}" target="_blank">{{ task.get_attachment_fname|truncatechars:32 }}</a>{% else %}&horbar;{% endif %}</td>
<td class="btn-group btn-group-justified"> <td class="btn-group btn-group-justified">
{% if perms.taskapp.change_task %} {% if perms.taskapp.change_task %}
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-sm btn-default" title="{% trans 'Edit' %}"> <a href="{% url 'taskapp:edit' task.id %}" class="btn btn-sm btn-default" title="{% trans 'Edit' %}">

5
taskapp/templates/taskapp/view.html

@ -17,16 +17,21 @@
<div class="panel-body"> <div class="panel-body">
<p>{% trans 'Description' %}: {{ task.descr }}</p> <p>{% trans 'Description' %}: {{ task.descr }}</p>
{% trans 'Task author' %}: <a href="{% url 'acc_app:other_profile' task.author.pk %}" title="{{ task.author.get_full_name }}" target="_blank">{{ task.author.username }}</a><br>
{% trans 'Implementers' %}: {% trans 'Implementers' %}:
<ul> <ul>
{% for recipient in task.recipients.all %} {% for recipient in task.recipients.all %}
<li><a href="{% url 'acc_app:other_profile' recipient.id %}" target="_blank">{{ recipient.get_full_name }}</a></li> <li><a href="{% url 'acc_app:other_profile' recipient.id %}" target="_blank">{{ recipient.get_full_name }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% trans 'A priority' %}: {{ task.get_priority_display }}<br>
{% trans 'The task is valid until' %} {{ task.out_date|date:'d E Y' }}<br> {% trans 'The task is valid until' %} {{ task.out_date|date:'d E Y' }}<br>
{% trans 'Date of create' %} {{ task.time_of_create|date:'d E Y' }}<br> {% trans 'Date of create' %} {{ task.time_of_create|date:'d E Y' }}<br>
{% trans 'time left' %} {{ time_diff }}<br> {% trans 'time left' %} {{ time_diff }}<br>
{% trans 'Task type' %}: {{ task.get_mode_display }}<br> {% trans 'Task type' %}: {{ task.get_mode_display }}<br>
{% trans 'Condition' %}: {{ task.get_state_display }}<br>
{% trans 'Subscriber' %} {% trans 'Subscriber' %}
{% if task.abon %} {% if task.abon %}
<a href="{% url 'abonapp:abon_home' task.abon.group.id task.abon.id %}" target="_blank">{{ task.abon.get_full_name }}</a> <a href="{% url 'abonapp:abon_home' task.abon.group.id task.abon.id %}" target="_blank">{{ task.abon.get_full_name }}</a>

6
taskapp/views.py

@ -7,7 +7,7 @@ from abonapp.models import Abon
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from datetime import date from datetime import date
from .models import Task from .models import Task
from mydefs import pag_mn, only_admins, safe_int, MultipleException
from mydefs import pag_mn, only_admins, safe_int, MultipleException, RuTimedelta
from .forms import TaskFrm from .forms import TaskFrm
@ -91,7 +91,7 @@ def view(request, task_id):
time_diff = tsk.out_date - toc time_diff = tsk.out_date - toc
return render(request, 'taskapp/view.html', { return render(request, 'taskapp/view.html', {
'task': tsk, 'task': tsk,
'time_diff': time_diff
'time_diff': RuTimedelta(time_diff)
}) })
@ -148,7 +148,7 @@ def task_add_edit(request, task_id=0):
elif uid: elif uid:
selected_abon = Abon.objects.get(username=str(uid)) selected_abon = Abon.objects.get(username=str(uid))
except Abon.DoesNotExist: except Abon.DoesNotExist:
messages.warning(request, _("User '%s' does not exist") % str(uid))
messages.warning(request, _("User does not exist"))
except MultipleException as errs: except MultipleException as errs:
for err in errs.err_list: for err in errs.err_list:
messages.add_message(request, messages.constants.ERROR, err) messages.add_message(request, messages.constants.ERROR, err)

Loading…
Cancel
Save