Browse Source

Реализовал перевод ru

devel
Dmitry 9 years ago
parent
commit
2cfe9717bd
  1. 3
      taskapp/forms.py
  2. 49
      taskapp/models.py
  3. 25
      taskapp/templates/taskapp/add_edit_task.html
  4. 15
      taskapp/templates/taskapp/ext.htm
  5. 5
      taskapp/templates/taskapp/footer_btns.html
  6. 27
      taskapp/templates/taskapp/tasklist.html
  7. 25
      taskapp/templates/taskapp/tasklist_active.html
  8. 31
      taskapp/templates/taskapp/tasklist_all.html
  9. 25
      taskapp/templates/taskapp/tasklist_finish.html
  10. 25
      taskapp/templates/taskapp/tasklist_own.html
  11. 23
      taskapp/templates/taskapp/view.html
  12. 9
      taskapp/views.py

3
taskapp/forms.py

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _
from datetime import timedelta
from django import forms
from django.utils import timezone
@ -12,7 +13,7 @@ class TaskFrm(forms.ModelForm):
exclude = ['time_of_create', 'author', 'recipients', 'device']
widgets = {
'descr': forms.TextInput(attrs={
'placeholder': 'Краткое описание',
'placeholder': _('Short description'),
'class': "form-control",
'autofocus': ''
}),

49
taskapp/models.py

@ -3,45 +3,46 @@ from datetime import timedelta
from django.db import models
from django.conf import settings
from django.utils import timezone
from django.utils.translation import ugettext as _
from abonapp.models import Abon
from .handle import handle as task_handle
TASK_PRIORITIES = (
('A', 'Высший'),
('C', 'Средний'),
('E', 'Низкий')
('A', _('Higher')),
('C', _('Average')),
('E', _('Low'))
)
TASK_STATES = (
('S', 'Новая'),
('C', 'На выполнении'),
('F', 'Выполнена')
('S', _('New')),
('C', _('In fulfilling')),
('F', _('Completed'))
)
TASK_TYPES = (
('na', 'не выбрано'),
('yt', 'жёлтый треугольник'),
('rc', 'красный крестик'),
('ls', 'слабая скорость'),
('cf', 'обрыв кабеля'),
('cn', 'подключение'),
('pf', 'переодическое пропадание'),
('cr', 'настройка роутера'),
('co', 'настроить onu'),
('fc', 'обжать кабель'),
('ot', 'другое')
('na', _('not chosen')),
('yt', _('yellow triangle')),
('rc', _('red cross')),
('ls', _('weak speed')),
('cf', _('cable break')),
('cn', _('connection')),
('pf', _('periodic disappearance')),
('cr', _('router setup')),
('co', _('configure onu')),
('fc', _('crimp cable')),
('ot', _('other'))
)
class ChangeLog(models.Model):
task = models.ForeignKey('Task')
ACT_CHOICES = (
('e', 'Изменение задачи'),
('c', 'Создание задачи'),
('d', 'Удаление задачи'),
('f', 'Завершение задачи'),
('b', 'Задача начата')
('e', _('Change task')),
('c', _('Create task')),
('d', _('Delete task')),
('f', _('Completing tasks')),
('b', _('The task started'))
)
act_type = models.CharField(max_length=1, choices=ACT_CHOICES)
when = models.DateTimeField(auto_now_add=True)
@ -72,8 +73,8 @@ class Task(models.Model):
db_table = 'task'
ordering = ('-id',)
permissions = (
('can_viewall', 'Доступ ко всем задачам'),
('can_remind', 'Напоминания о задачах')
('can_viewall', _('Access to all tasks')),
('can_remind', _('Reminders of tasks'))
)
def finish(self, current_user):

25
taskapp/templates/taskapp/add_edit_task.html

@ -1,17 +1,18 @@
{% extends request.is_ajax|yesno:'bajax.html,base.html' %}
{% load i18n %}
{% block main %}
<ol class="breadcrumb">
<li><span class="glyphicon glyphicon-home"></span></li>
<li><a href="{% url 'taskapp:home' %}">Задачи</a></li>
<li class="active">{% if task_id %}Редактировать{% else %}Создать{% endif %}</li>
<li><a href="{% url 'taskapp:home' %}">{% trans 'Tasks' %}</a></li>
<li class="active">{% if task_id %}{% trans 'Edit' %}{% else %}{% trans 'Create' %}{% endif %}</li>
</ol>
{% include 'message_block.html' %}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Добавьте новую задачу</h3>
<h3 class="panel-title">{% trans 'Add new task' %}</h3>
</div>
<div class="panel-body">
@ -23,7 +24,7 @@
{% csrf_token %}<input type="hidden" name="MAX_FILE_SIZE" value="409600"/>
<div class="form-group">
<label for="id_descr">Пару слов...</label>
<label for="id_descr">{% trans 'Description' %}</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-tag"></span></span>
@ -31,7 +32,7 @@
</div>
</div>
<div class="form-group">
<label for="id_mode">Характер поломки</label>
<label for="id_mode">{% trans 'The nature of the damage' %}</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-pawn"></span></span>
@ -39,7 +40,7 @@
</div>
</div>
<div class="form-group">
<label for="id_priority">Приоритет</label>
<label for="id_priority">{% trans 'A priority' %}</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-sort-by-order"></span></span>
@ -47,7 +48,7 @@
</div>
</div>
<div class="form-group">
<label for="id_state">Состояние</label>
<label for="id_state">{% trans 'Condition' %}</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-retweet"></span></span>
@ -55,7 +56,7 @@
</div>
</div>
<div class="form-group">
<label for="id_abon">Абонент</label>
<label for="id_abon">{% trans 'Subscriber' %}</label>
<div class="input-group selectajax">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
@ -71,7 +72,7 @@
</div>
</div>
<div class="form-group">
<label for="id_out_date">Актуальность (дата, до которой нужно завершить задачу)</label>
<label for="id_out_date">{% trans 'Reality (the date by which you must complete the task)' %}</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
@ -87,7 +88,7 @@
</script>
</div>
<div class="form-group">
<label for="id_attachment">Прикреплённое изображение</label>
<label for="id_attachment">{% trans 'Attached image' %}</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-picture"></span></span>
{{ form.attachment }}{{ form.attachment.errors }}
@ -95,10 +96,10 @@
</div>
<div class="btn-group">
<button type="submit" class="btn btn-sm btn-primary">
<span class="glyphicon glyphicon-save"></span> Сохранить
<span class="glyphicon glyphicon-save"></span> {% trans 'Save' %}
</button>
<button type="reset" class="btn btn-sm btn-default">
<span class="glyphicon glyphicon-remove-circle"></span> Сбросить
<span class="glyphicon glyphicon-remove-circle"></span> {% trans 'Reset' %}
</button>
</div>
</form>

15
taskapp/templates/taskapp/ext.htm

@ -1,16 +1,17 @@
{% extends request.is_ajax|yesno:'bajax.html,base.html' %}
{% load i18n %}
{% block main %}
<ol class="breadcrumb">
<li><span class="glyphicon glyphicon-home"></span></li>
<li class="active">Задачи</li>
<li class="active">{% trans 'Tasks' %}</li>
</ol>
{% include 'message_block.html' %}
<div class="page-header">
<h2>Задачи, которые необходимо выполнить</h2>
<h2>{% trans 'Tasks to be performed' %}</h2>
</div>
<ul class="nav nav-tabs">
@ -18,35 +19,35 @@
{% url 'taskapp:home' as taskhome %}
<li{% if taskhome == request.path %} class="active"{% endif %}>
<a href="{{ taskhome }}">
Новые задачи
{% trans 'New tasks' %}
</a>
</li>
{% url 'taskapp:active_tasks' as taskactive %}
<li{% if taskactive == request.path %} class="active"{% endif %}>
<a href="{{ taskactive }}">
Активные задачи
{% trans 'Active tasks' %}
</a>
</li>
{% url 'taskapp:finished_tasks' as taskfin %}
<li{% if taskfin == request.path %} class="active"{% endif %}>
<a href="{{ taskfin }}">
Выполненные задачи
{% trans 'Completed tasks' %}
</a>
</li>
{% url 'taskapp:own_tasks' as taskown %}
<li{% if taskown == request.path %} class="active"{% endif %}>
<a href="{{ taskown }}">
Назначенные мной задачи
{% trans 'Scheduled tasks me' %}
</a>
</li>
{% url 'taskapp:my_tasks' as taskmy %}
<li{% if taskmy == request.path %} class="active"{% endif %}>
<a href="{{ taskmy }}">
Все мои задачи
{% trans 'All my tasks' %}
</a>
</li>

5
taskapp/templates/taskapp/footer_btns.html

@ -1,10 +1,11 @@
{% load i18n %}
{% if perms.taskapp.add_task %}
<a href="{% url 'taskapp:add' %}" class="btn btn-sm btn-success" title="Создать новую задачу">
<span class="glyphicon glyphicon-plus"></span> Добавить задачу
<span class="glyphicon glyphicon-plus"></span> {% trans 'Add new task' %}
</a>
{% endif %}
{% if perms.taskapp.can_viewall %}
<a href="{% url 'taskapp:all_tasks' %}" class="btn btn-sm btn-info">
<span class="glyphicon glyphicon-baby-formula"></span> Просмотреть все задачи
<span class="glyphicon glyphicon-baby-formula"></span> {% trans 'View all tasks' %}
</a>
{% endif %}

27
taskapp/templates/taskapp/tasklist.html

@ -1,4 +1,5 @@
{% extends request.is_ajax|yesno:'nullcont.htm,taskapp/ext.htm' %}
{% load i18n %}
{% block content %}
<div class="table-responsive">
@ -6,14 +7,14 @@
<thead>
<tr>
<th>#</th>
<th class="col-sm-4">Пару слов..</th>
<th class="col-sm-1">Кто назначил</th>
<th class="col-sm-1">Характер поломки</th>
<th class="col-sm-1">Состояние</th>
<th class="col-sm-1">Приоритет</th>
<th class="col-sm-1">Дата создания</th>
<th class="col-sm-1">Приложение</th>
<th class="col-sm-2" colspan="3">Действия</th>
<th class="col-sm-4">{% trans 'Description' %}</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 'Attachment' %}</th>
<th class="col-sm-2" colspan="3">{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
@ -34,17 +35,17 @@
<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 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.attachment.name }}</a>{% else %}&horbar;{% endif %}</td>
<td colspan="3" class="btn-group btn-group-justified">
<a href="{% url 'taskapp:begin' task.id %}" class="btn btn-primary btn-xs" title="Начать">
<a href="{% url 'taskapp:begin' task.id %}" class="btn btn-primary btn-xs" title="{% trans 'Begin' %}">
<span class="glyphicon glyphicon-cog"></span>
</a>
<a href="{% url 'taskapp:finish' task.id %}" class="btn btn-success btn-xs" title="Завершить">
<a href="{% url 'taskapp:finish' task.id %}" class="btn btn-success btn-xs" title="{% trans 'Complete' %}">
<span class="glyphicon glyphicon-ok"></span>
</a>
{% if perms.taskapp.change_task %}
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-default btn-xs" title="Редактировать">
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-default btn-xs" title="{% trans 'Edit' %}">
<span class="glyphicon glyphicon-edit"></span>
</a>
{% endif %}
@ -52,7 +53,7 @@
</tr>
{% empty %}
<tr>
<td colspan="11">Список пуст</td>
<td colspan="11">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>

25
taskapp/templates/taskapp/tasklist_active.html

@ -1,4 +1,5 @@
{% extends request.is_ajax|yesno:'nullcont.htm,taskapp/ext.htm' %}
{% load i18n %}
{% block content %}
<div class="table-responsive">
@ -6,14 +7,14 @@
<thead>
<tr>
<th>#</th>
<th class="col-sm-4">Пару слов..</th>
<th class="col-sm-1">Кто назначил</th>
<th class="col-sm-1">Характер поломки</th>
<th class="col-sm-1">Состояние</th>
<th class="col-sm-1">Приоритет</th>
<th class="col-sm-1">Дата создания</th>
<th class="col-sm-1">Приложение</th>
<th class="col-sm-2" colspan="3">Действия</th>
<th class="col-sm-4">{% trans 'Description' %}</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 'Attachment' %}</th>
<th class="col-sm-2" colspan="3">{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
@ -35,14 +36,14 @@
<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 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.attachment.name }}</a>{% else %}&horbar;{% endif %}</td>
<td colspan="3" class="btn-group">
<a href="{% url 'taskapp:finish' task.id %}" class="btn btn-sm btn-success" title="Завершить">
<a href="{% url 'taskapp:finish' task.id %}" class="btn btn-sm btn-success" title="{% trans 'Complete' %}">
<span class="glyphicon glyphicon-ok"></span>
</a>
{% if perms.taskapp.change_task %}
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-sm btn-default" title="Редактировать">
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-sm btn-default" title="{% trans 'Edit' %}">
<span class="glyphicon glyphicon-edit"></span>
</a>
{% endif %}
@ -50,7 +51,7 @@
</tr>
{% empty %}
<tr>
<td colspan="11">Список пуст</td>
<td colspan="11">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>

31
taskapp/templates/taskapp/tasklist_all.html

@ -1,16 +1,17 @@
{% extends request.is_ajax|yesno:'bajax.html,base.html' %}
{% load i18n %}
{% block main %}
<ol class="breadcrumb">
<li><span class="glyphicon glyphicon-home"></span></li>
<li><a href="{% url 'taskapp:home' %}">Задачи</a></li>
<li class="active">Все задачи</li>
<li><a href="{% url 'taskapp:home' %}">{% trans 'Tasks' %}</a></li>
<li class="active">{% trans 'All tasks' %}</li>
</ol>
{% include 'message_block.html' %}
<div class="page-header">
<h2>Лог всех задач в системе</h2>
<h2>{% trans 'Records of all the tasks in the system' %}</h2>
</div>
<div class="table-responsive">
@ -18,14 +19,14 @@
<thead>
<tr>
<th>#</th>
<th class="col-sm-4">Пару слов..</th>
<th class="col-sm-1">Кто назначил</th>
<th class="col-sm-1">Характер поломки</th>
<th class="col-sm-1">Состояние</th>
<th class="col-sm-1">Приоритет</th>
<th class="col-sm-1">Дата создания</th>
<th class="col-sm-1">Приложение</th>
<th class="col-sm-2" colspan="3">Действия</th>
<th class="col-sm-4">{% trans 'Description' %}</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 'Attachment' %}</th>
<th class="col-sm-2" colspan="3">{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
@ -46,16 +47,16 @@
<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 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.attachment.name }}</a>{% else %}&horbar;{% endif %}</td>
<td colspan="3" class="btn-group btn-group-justified">
{% if perms.taskapp.change_task %}
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-default btn-sm" title="Редактировать">
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-default btn-sm" title="{% trans 'Edit' %}">
<span class="glyphicon glyphicon-edit"></span>
</a>
{% endif %}
{% if perms.taskapp.can_remind %}
<a href="{% url 'taskapp:remind' task.id %}" class="btn btn-default btn-sm" title="Напомнить">
<a href="{% url 'taskapp:remind' task.id %}" class="btn btn-default btn-sm" title="{% trans 'Remind' %}">
<span class="glyphicon glyphicon-bell"></span>
</a>
{% endif %}
@ -63,7 +64,7 @@
</tr>
{% empty %}
<tr>
<td colspan="12">Список пуст</td>
<td colspan="12">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>

25
taskapp/templates/taskapp/tasklist_finish.html

@ -1,4 +1,5 @@
{% extends request.is_ajax|yesno:'nullcont.htm,taskapp/ext.htm' %}
{% load i18n %}
{% block content %}
<div class="table-responsive">
@ -6,14 +7,14 @@
<thead>
<tr>
<th>#</th>
<th class="col-sm-4">Пару слов..</th>
<th class="col-sm-1">Кто назначил</th>
<th class="col-sm-1">Характер поломки</th>
<th class="col-sm-1">Состояние</th>
<th class="col-sm-1">Приоритет</th>
<th class="col-sm-1">Дата создания</th>
<th class="col-sm-1">Приложение</th>
<th class="col-sm-2" colspan="3">Действия</th>
<th class="col-sm-4">{% trans 'Description' %}</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 'Attachment' %}</th>
<th class="col-sm-2" colspan="3">{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
@ -35,16 +36,16 @@
<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 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.attachment.name }}</a>{% else %}&horbar;{% endif %}</td>
<td colspan="3" class="btn-group">
{% if perms.taskapp.change_task %}
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-sm btn-default" title="Редактировать">
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-sm btn-default" title="{% trans 'Edit' %}">
<span class="glyphicon glyphicon-edit"></span>
</a>
{% endif %}
{% if perms.taskapp.delete_task %}
<a href="#" class="btn btn-sm btn-danger disabled" title="Удалить">
<a href="{% url 'taskapp:delete' task.id %}" class="btn btn-sm btn-danger disabled" title="{% trans 'Delete' %}">
<span class="glyphicon glyphicon-remove-circle"></span>
</a>
{% endif %}
@ -52,7 +53,7 @@
</tr>
{% empty %}
<tr>
<td colspan="11">Список пуст</td>
<td colspan="11">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>

25
taskapp/templates/taskapp/tasklist_own.html

@ -1,4 +1,5 @@
{% extends request.is_ajax|yesno:'nullcont.htm,taskapp/ext.htm' %}
{% load i18n %}
{% block content %}
<div class="table-responsive">
@ -6,13 +7,13 @@
<thead>
<tr>
<th>#</th>
<th class="col-sm-6">Пару слов..</th>
<th class="col-sm-1">Характер поломки</th>
<th class="col-sm-1">Состояние</th>
<th class="col-sm-1">Приоритет</th>
<th class="col-sm-1">Дата создания</th>
<th class="col-sm-1">Приложение</th>
<th class="col-sm-1">Действия</th>
<th class="col-sm-4">{% trans 'Description' %}</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 'Attachment' %}</th>
<th class="col-sm-1">{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
@ -32,21 +33,21 @@
<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 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.attachment.name }}</a>{% else %}&horbar;{% endif %}</td>
<td class="btn-group btn-group-justified">
{% if perms.taskapp.change_task %}
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-sm btn-default" title="Редактировать">
<a href="{% url 'taskapp:edit' task.id %}" class="btn btn-sm btn-default" title="{% trans 'Edit' %}">
<span class="glyphicon glyphicon-edit"></span>
</a>
{% endif %}
{% if perms.taskapp.can_remind %}
<a href="{% url 'taskapp:remind' task.id %}" class="btn btn-default btn-sm" title="Напомнить">
<a href="{% url 'taskapp:remind' task.id %}" class="btn btn-default btn-sm" title="{% trans 'Remind' %}">
<span class="glyphicon glyphicon-bell"></span>
</a>
{% endif %}
{% if perms.taskapp.delete_task %}
<a href="{% url 'taskapp:delete' task.id %}" class="btn btn-sm btn-danger" title="Удалить">
<a href="{% url 'taskapp:delete' task.id %}" class="btn btn-sm btn-danger" title="{% trans 'Delete' %}">
<span class="glyphicon glyphicon-remove-circle"></span>
</a>
{% endif %}
@ -54,7 +55,7 @@
</tr>
{% empty %}
<tr>
<td colspan="8">Все ваши задачи выполнены</td>
<td colspan="8">{% trans 'All your tasks has been performed' %}</td>
</tr>
{% endfor %}
</tbody>

23
taskapp/templates/taskapp/view.html

@ -1,9 +1,10 @@
{% extends request.is_ajax|yesno:'bajax.html,base.html' %}
{% load i18n %}
{% block main %}
<ol class="breadcrumb">
<li><span class="glyphicon glyphicon-home"></span></li>
<li><a href="{% url 'taskapp:home' %}">Задачи</a></li>
<li><a href="{% url 'taskapp:home' %}">{% trans 'Tasks' %}</a></li>
<li class="active">#{{ task.id }}</li>
</ol>
@ -11,29 +12,29 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Описание задачи</h3>
<h3 class="panel-title">{% trans 'Task description' %}</h3>
</div>
<div class="panel-body">
<p>Описание: {{ task.descr }}</p>
Исполнители:
<p>{% trans 'Description' %}: {{ task.descr }}</p>
{% trans 'Implementers' %}:
<ul>
{% for recipient in task.recipients.all %}
<li><a href="{% url 'acc_app:other_profile' recipient.id %}" target="_blank">{{ recipient.get_full_name }}</a></li>
{% endfor %}
</ul>
Задача действительна до {{ task.out_date|date:'d E Y' }}<br>
Дата создания {{ task.time_of_create|date:'d E Y' }}<br>
Времени осталось {{ time_diff }}<br>
Тип задачи: {{ task.get_mode_display }}<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 'time left' %} {{ time_diff }}<br>
{% trans 'Task type' %}: {{ task.get_mode_display }}<br>
{% trans 'Subscriber' %}
{% if task.abon %}
<a href="{% url 'abonapp:abon_home' task.abon.group.id task.abon.id %}" target="_blank">{{ task.abon.get_full_name }}</a>
{% else %}
<i>&lt;Не выбран&gt;</i>
<i>{% trans 'Not assigned' %}</i>
{% endif %}<br>
{% if task.attachment %}
Приложение:
{% trans 'Attachment' %}:
<a href="{{ task.attachment.url }}" class="thumbnail" target="_blank">
<img src="{{ task.attachment.url }}">
</a>

9
taskapp/views.py

@ -4,6 +4,7 @@ from django.core.exceptions import PermissionDenied
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib import messages
from abonapp.models import Abon
from django.utils.translation import ugettext as _
from datetime import date
from chatbot.models import TelegramBot
from .models import Task
@ -142,13 +143,13 @@ def task_add_edit(request, task_id=0):
task_instance.save()
return redirect('taskapp:home')
else:
messages.error(request, 'Нет ответственных за группу, в которой находится выбранный абонент')
messages.error(request, _('No responsible employee for the users group'))
else:
messages.error(request, 'Нужно выбрать абонента')
messages.error(request, _('You must select the subscriber'))
else:
messages.error(request, 'Ошибка в полях формы в задаче')
messages.error(request, _('Error in the form fields'))
except TelegramBot.DoesNotExist:
messages.error(request, 'Исполнитель ещё не подписался на оповещения')
messages.error(request, _('Employee has not yet signed up for notifications'))
return render(request, 'taskapp/add_edit_task.html', {
'form': frm,

Loading…
Cancel
Save