diff --git a/devapp/views.py b/devapp/views.py index c37a46a..e3c9075 100644 --- a/devapp/views.py +++ b/devapp/views.py @@ -767,7 +767,7 @@ class OnDeviceMonitoringEvent(global_base_views.SecureApiView): user_ids = tuple(recipient.pk for recipient in recipients.only('pk').iterator()) text = gettext(notify_text) % { 'device_name': "%s(%s) %s" % ( - device_down.ip_address, + device_down.ip_address or '', device_down.mac_addr, device_down.comment ) diff --git a/messenger/views.py b/messenger/views.py index 1283ea4..260c2b2 100644 --- a/messenger/views.py +++ b/messenger/views.py @@ -8,8 +8,10 @@ from django.views.generic import ListView, CreateView, UpdateView, DeleteView, F from django.views.generic.detail import SingleObjectMixin from viberbot.api.messages import KeyboardMessage, ContactMessage from viberbot.api.user_profile import UserProfile as ViberUserProfile -from viberbot.api.viber_requests import ViberMessageRequest, ViberSubscribedRequest, ViberFailedRequest, \ - ViberUnsubscribedRequest +from viberbot.api.viber_requests import ( + ViberMessageRequest, ViberSubscribedRequest, + ViberFailedRequest, ViberUnsubscribedRequest +) from accounts_app.models import UserProfile from djing.lib.mixins import LoginAdminPermissionMixin, LoginAdminMixin @@ -126,7 +128,7 @@ class ListenViberView(SingleObjectMixin, View): "TextSize": "medium" },) }, min_api_version=3) - viber = self.object.get_viber() + viber = self.object viber.send_message_to_id(viber_user_profile.id, msg) return subscriber, created @@ -143,7 +145,8 @@ class ListenViberView(SingleObjectMixin, View): if subs_len > 1: ViberSubscriber.objects.exclude(pk=first_sub.pk).delete() first_sub.account = first_acc - first_sub.save(update_fields=('account',)) + first_sub.name = first_acc.get_full_name() + first_sub.save(update_fields=('account', 'name')) viber.send_message_to_acc(first_acc, gettext( 'Your account is attached. Now you will be receive notifications from billing' )) diff --git a/taskapp/locale/ru/LC_MESSAGES/django.po b/taskapp/locale/ru/LC_MESSAGES/django.po index af02fc2..880d97a 100644 --- a/taskapp/locale/ru/LC_MESSAGES/django.po +++ b/taskapp/locale/ru/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-24 13:41+0300\n" +"POT-Creation-Date: 2019-04-11 10:48+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Dmitry Novikov nerosketch@gmail.com\n" "Language: ru\n" @@ -31,11 +31,11 @@ msgstr "Нужно выбрать абонента" msgid "Short description" msgstr "Краткое описание" -#: handle.py:17 views.py:276 +#: handle.py:22 msgid "Task" msgstr "Задача" -#: handle.py:23 +#: handle.py:26 msgid "Task completed" msgstr "Задача завершена" @@ -135,7 +135,7 @@ msgstr "Завершение задачи" msgid "The task failed" msgstr "Задача провалена" -#: models.py:63 templates/taskapp/details.html:8 +#: models.py:67 templates/taskapp/details.html:8 #: templates/taskapp/tasklist.html:12 templates/taskapp/tasklist_all.html:28 #: templates/taskapp/tasklist_empty.html:18 #: templates/taskapp/tasklist_failed.html:18 @@ -144,11 +144,11 @@ msgstr "Задача провалена" msgid "Description" msgstr "Описание" -#: models.py:64 +#: models.py:71 msgid "Recipients" msgstr "Исполнители" -#: models.py:67 templates/taskapp/details.html:10 +#: models.py:77 templates/taskapp/details.html:10 #: templates/taskapp/tasklist.html:13 templates/taskapp/tasklist_all.html:29 #: templates/taskapp/tasklist_empty.html:19 #: templates/taskapp/tasklist_failed.html:19 @@ -156,15 +156,15 @@ msgstr "Исполнители" msgid "Task author" msgstr "Автор задачи" -#: models.py:68 templates/taskapp/details.html:23 +#: models.py:80 templates/taskapp/details.html:23 msgid "A priority" msgstr "Приоритет" -#: models.py:69 templates/taskapp/add_edit_task.html:66 +#: models.py:84 templates/taskapp/add_edit_task.html:66 msgid "Reality" msgstr "Актуальность (дата, до которой нужно завершить задачу)" -#: models.py:70 templates/taskapp/details.html:25 +#: models.py:88 templates/taskapp/details.html:25 #: templates/taskapp/tasklist.html:14 templates/taskapp/tasklist_all.html:31 #: templates/taskapp/tasklist_empty.html:20 #: templates/taskapp/tasklist_failed.html:20 @@ -173,17 +173,17 @@ msgstr "Актуальность (дата, до которой нужно за msgid "Date of create" msgstr "Дата создания" -#: models.py:71 templates/taskapp/details.html:28 +#: models.py:91 templates/taskapp/details.html:28 #: templates/taskapp/tasklist_all.html:30 #: templates/taskapp/tasklist_own.html:14 msgid "Condition" msgstr "Состояние" -#: models.py:72 +#: models.py:95 msgid "Attached image" msgstr "Прикреплённое изображение" -#: models.py:73 templates/taskapp/tasklist.html:11 +#: models.py:99 templates/taskapp/tasklist.html:11 #: templates/taskapp/tasklist_all.html:27 #: templates/taskapp/tasklist_empty.html:17 #: templates/taskapp/tasklist_failed.html:17 @@ -192,40 +192,40 @@ msgstr "Прикреплённое изображение" msgid "The nature of the damage" msgstr "Характер поломки" -#: models.py:74 templates/taskapp/add_edit_task.html:50 +#: models.py:104 templates/taskapp/add_edit_task.html:50 #: templates/taskapp/details.html:29 msgid "Subscriber" msgstr "Абонент" -#: models.py:80 +#: models.py:111 msgid "Access to all tasks" msgstr "Доступ ко всем задачам" -#: models.py:81 +#: models.py:112 msgid "Reminders of tasks" msgstr "Напоминания о задачах" -#: models.py:117 +#: models.py:148 msgid "Text of comment" msgstr "Текст комментария" -#: models.py:118 +#: models.py:150 msgid "Owner task" msgstr "Владелец задачи" -#: models.py:119 +#: models.py:154 msgid "Author" msgstr "Автор" -#: models.py:120 +#: models.py:157 msgid "Time of create" msgstr "Дата создания" -#: models.py:130 +#: models.py:167 msgid "Extra comment" msgstr "Комментарий" -#: models.py:131 +#: models.py:168 msgid "Extra comments" msgstr "Комментарии" @@ -246,7 +246,7 @@ msgstr "Редактировать" msgid "Create" msgstr "Создать" -#: templates/taskapp/add_edit_task.html:20 templates/taskapp/footer_btns.html:5 +#: templates/taskapp/add_edit_task.html:20 templates/taskapp/footer_btns.html:6 #: templates/taskapp/tasklist_all.html:115 #: templates/taskapp/tasklist_all.html:116 msgid "Add new task" @@ -261,21 +261,26 @@ msgstr "Редактировать задачу" msgid "Find the subscriber" msgstr "Найти абонента" -#: templates/taskapp/add_edit_task.html:86 +#: templates/taskapp/add_edit_task.html:79 msgid "Save" msgstr "Сохранить" -#: templates/taskapp/add_edit_task.html:89 +#: templates/taskapp/add_edit_task.html:82 msgid "Reset" msgstr "Сбросить" -#: templates/taskapp/add_edit_task.html:93 +#: templates/taskapp/add_edit_task.html:86 #: templates/taskapp/comments/extracomment_confirm_delete.html:15 #: templates/taskapp/comments/task_comments.html:12 #: templates/taskapp/tasklist_own.html:71 msgid "Delete" msgstr "Удалить" +#: templates/taskapp/add_edit_task.html:91 templates/taskapp/tasklist.html:75 +#: templates/taskapp/tasklist_failed.html:65 +msgid "Complete" +msgstr "Завершить" + #: templates/taskapp/comments/extracomment_confirm_delete.html:6 msgid "Delete comment" msgstr "Удаление комментарий" @@ -331,39 +336,41 @@ msgstr "Тип задачи" msgid "Attachment" msgstr "Приложение" -#: templates/taskapp/footer_btns.html:10 +#: templates/taskapp/footer_btns.html:12 msgid "View all tasks" msgstr "Просмотреть все задачи" -#: templates/taskapp/footer_btns.html:14 +#: templates/taskapp/footer_btns.html:15 +msgid "View all new tasks" +msgstr "Все незавершённые задачи" + +#: templates/taskapp/footer_btns.html:20 msgid "View empty tasks" msgstr "Задачи без получателей" #: templates/taskapp/notification.html:2 msgid "" "\n" -"
\n" -" %(task_status)s\n" -" %(abon)s\n" -" In group: %(group)s\n" -" Street: %(street)s\n" -" House: %(house)s\n" -" Tel: %(telephone)s\n" -" Task type: %(task_type)s\n" -"\n" -"
%(task_detail)s
\n" +"%(task_status)s\n" +"%(abon)s\n" +"In group: %(group)s\n" +"Street: %(street)s\n" +"House: %(house)s\n" +"Tel: %(telephone)s\n" +"Task type: %(task_type)s\n" +"\n" +"%(task_detail)s\n" msgstr "" "\n" -"\n" -" %(task_status)s\n" -" %(abon)s\n" -" Группа: %(group)s\n" -" Улица: %(street)s\n" -" Дом: %(house)s\n" -" Телефон: %(telephone)s\n" -" Тип задачи: %(task_type)s\n" -"\n" -"
%(task_detail)s
\n" +"%(task_status)s\n" +"%(abon)s\n" +"Группа: %(group)s\n" +"Улица: %(street)s\n" +"Дом: %(house)s\n" +"Телефон: %(telephone)s\n" +"Тип задачи: %(task_type)s\n" +"\n" +"%(task_detail)s\n" #: templates/taskapp/tasklist.html:9 templates/taskapp/tasklist_all.html:25 msgid "Name and comment count" @@ -404,10 +411,6 @@ msgstr "Сегодня" msgid "Yesterday" msgstr "Вчера" -#: templates/taskapp/tasklist.html:75 templates/taskapp/tasklist_failed.html:65 -msgid "Complete" -msgstr "Завершить" - #: templates/taskapp/tasklist.html:78 msgid "Mark as unsuccessful" msgstr "Отметить задачу как проваленную" @@ -460,31 +463,39 @@ msgstr "Автор не указан" msgid "All your tasks has been performed" msgstr "Все ваши задачи выполнены" -#: views.py:124 +#: views.py:134 msgid "You cannot delete task that assigned to you" msgstr "Вы не можете удалять назначенные на вас задачи" -#: views.py:175 +#: views.py:171 views.py:192 +msgid "New task with this user already exists. You are redirected to it." +msgstr "Заявка для этого абонента уже создана. Вы перенаправлены к ней." + +#: views.py:203 msgid "Task has successfully created" msgstr "Задача успешно создана" -#: views.py:177 +#: views.py:205 msgid "Task has changed successfully" msgstr "Задача успешно изменена" -#: views.py:197 +#: views.py:225 msgid "time left" msgstr "Времени осталось" -#: views.py:199 +#: views.py:227 #, python-format msgid "Expired timeout -%(time_left)s" msgstr "Время ожидания истекло -%(time_left)s" -#: views.py:220 +#: views.py:252 msgid "fix form errors" msgstr "исправте ошибки формы" +#: views.py:292 +msgid "Task has been reminded" +msgstr "Напоминание о задаче отправлено" + msgid "Failed tasks" msgstr "Проваленные задачи" @@ -502,12 +513,3 @@ msgstr "Назначенные мной задачи" msgid "Tasks to be performed" msgstr "Задачи, которые необходимо выполнить" - -msgid "Task has been reminded" -msgstr "Напоминание о задаче отправлено" - -msgid "View all new tasks" -msgstr "Все незавершённые задачи" - -msgid "New task with this user already exists. You are redirected to it." -msgstr "Заявка для этого абонента уже создана. Вы перенаправлены к ней." diff --git a/taskapp/templates/taskapp/notification.html b/taskapp/templates/taskapp/notification.html index 00449b4..794a089 100644 --- a/taskapp/templates/taskapp/notification.html +++ b/taskapp/templates/taskapp/notification.html @@ -1,13 +1,12 @@ {% load i18n %} {% blocktrans with abon_url=abon.get_absolute_url group=abon.group street=abon.street house=abon.house telephone=abon.telephone task_type=task.get_mode_display task_detail=task.descr %} -
- {{ task_status }}
- {{ abon }}
- In group: {{ group }}
- Street: {{ street }}
- House: {{ house }}
- Tel: {{ telephone }}
- Task type: {{ task_type }}
-
- {{ task_detail }}
+{{ task_status }} +{{ abon }} +In group: {{ group }} +Street: {{ street }} +House: {{ house }} +Tel: {{ telephone }} +Task type: {{ task_type }} + +{{ task_detail }} {% endblocktrans %}