Browse Source

fix notifyes

devel
Dmitry Novikov 7 years ago
parent
commit
ed29acae0e
  1. 2
      devapp/views.py
  2. 11
      messenger/views.py
  3. 110
      taskapp/locale/ru/LC_MESSAGES/django.po
  4. 7
      taskapp/templates/taskapp/notification.html

2
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()) user_ids = tuple(recipient.pk for recipient in recipients.only('pk').iterator())
text = gettext(notify_text) % { text = gettext(notify_text) % {
'device_name': "%s(%s) %s" % ( 'device_name': "%s(%s) %s" % (
device_down.ip_address,
device_down.ip_address or '',
device_down.mac_addr, device_down.mac_addr,
device_down.comment device_down.comment
) )

11
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 django.views.generic.detail import SingleObjectMixin
from viberbot.api.messages import KeyboardMessage, ContactMessage from viberbot.api.messages import KeyboardMessage, ContactMessage
from viberbot.api.user_profile import UserProfile as ViberUserProfile 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 accounts_app.models import UserProfile
from djing.lib.mixins import LoginAdminPermissionMixin, LoginAdminMixin from djing.lib.mixins import LoginAdminPermissionMixin, LoginAdminMixin
@ -126,7 +128,7 @@ class ListenViberView(SingleObjectMixin, View):
"TextSize": "medium" "TextSize": "medium"
},) },)
}, min_api_version=3) }, min_api_version=3)
viber = self.object.get_viber()
viber = self.object
viber.send_message_to_id(viber_user_profile.id, msg) viber.send_message_to_id(viber_user_profile.id, msg)
return subscriber, created return subscriber, created
@ -143,7 +145,8 @@ class ListenViberView(SingleObjectMixin, View):
if subs_len > 1: if subs_len > 1:
ViberSubscriber.objects.exclude(pk=first_sub.pk).delete() ViberSubscriber.objects.exclude(pk=first_sub.pk).delete()
first_sub.account = first_acc 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( viber.send_message_to_acc(first_acc, gettext(
'Your account is attached. Now you will be receive notifications from billing' 'Your account is attached. Now you will be receive notifications from billing'
)) ))

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

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Dmitry Novikov nerosketch@gmail.com\n" "Last-Translator: Dmitry Novikov nerosketch@gmail.com\n"
"Language: ru\n" "Language: ru\n"
@ -31,11 +31,11 @@ msgstr "Нужно выбрать абонента"
msgid "Short description" msgid "Short description"
msgstr "Краткое описание" msgstr "Краткое описание"
#: handle.py:17 views.py:276
#: handle.py:22
msgid "Task" msgid "Task"
msgstr "Задача" msgstr "Задача"
#: handle.py:23
#: handle.py:26
msgid "Task completed" msgid "Task completed"
msgstr "Задача завершена" msgstr "Задача завершена"
@ -135,7 +135,7 @@ msgstr "Завершение задачи"
msgid "The task failed" msgid "The task failed"
msgstr "Задача провалена" 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.html:12 templates/taskapp/tasklist_all.html:28
#: templates/taskapp/tasklist_empty.html:18 #: templates/taskapp/tasklist_empty.html:18
#: templates/taskapp/tasklist_failed.html:18 #: templates/taskapp/tasklist_failed.html:18
@ -144,11 +144,11 @@ msgstr "Задача провалена"
msgid "Description" msgid "Description"
msgstr "Описание" msgstr "Описание"
#: models.py:64
#: models.py:71
msgid "Recipients" msgid "Recipients"
msgstr "Исполнители" 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.html:13 templates/taskapp/tasklist_all.html:29
#: templates/taskapp/tasklist_empty.html:19 #: templates/taskapp/tasklist_empty.html:19
#: templates/taskapp/tasklist_failed.html:19 #: templates/taskapp/tasklist_failed.html:19
@ -156,15 +156,15 @@ msgstr "Исполнители"
msgid "Task author" msgid "Task author"
msgstr "Автор задачи" msgstr "Автор задачи"
#: models.py:68 templates/taskapp/details.html:23
#: models.py:80 templates/taskapp/details.html:23
msgid "A priority" msgid "A priority"
msgstr "Приоритет" msgstr "Приоритет"
#: models.py:69 templates/taskapp/add_edit_task.html:66
#: models.py:84 templates/taskapp/add_edit_task.html:66
msgid "Reality" msgid "Reality"
msgstr "Актуальность (дата, до которой нужно завершить задачу)" 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.html:14 templates/taskapp/tasklist_all.html:31
#: templates/taskapp/tasklist_empty.html:20 #: templates/taskapp/tasklist_empty.html:20
#: templates/taskapp/tasklist_failed.html:20 #: templates/taskapp/tasklist_failed.html:20
@ -173,17 +173,17 @@ msgstr "Актуальность (дата, до которой нужно за
msgid "Date of create" msgid "Date of create"
msgstr "Дата создания" 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_all.html:30
#: templates/taskapp/tasklist_own.html:14 #: templates/taskapp/tasklist_own.html:14
msgid "Condition" msgid "Condition"
msgstr "Состояние" msgstr "Состояние"
#: models.py:72
#: models.py:95
msgid "Attached image" msgid "Attached image"
msgstr "Прикреплённое изображение" 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_all.html:27
#: templates/taskapp/tasklist_empty.html:17 #: templates/taskapp/tasklist_empty.html:17
#: templates/taskapp/tasklist_failed.html:17 #: templates/taskapp/tasklist_failed.html:17
@ -192,40 +192,40 @@ msgstr "Прикреплённое изображение"
msgid "The nature of the damage" msgid "The nature of the damage"
msgstr "Характер поломки" 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 #: templates/taskapp/details.html:29
msgid "Subscriber" msgid "Subscriber"
msgstr "Абонент" msgstr "Абонент"
#: models.py:80
#: models.py:111
msgid "Access to all tasks" msgid "Access to all tasks"
msgstr "Доступ ко всем задачам" msgstr "Доступ ко всем задачам"
#: models.py:81
#: models.py:112
msgid "Reminders of tasks" msgid "Reminders of tasks"
msgstr "Напоминания о задачах" msgstr "Напоминания о задачах"
#: models.py:117
#: models.py:148
msgid "Text of comment" msgid "Text of comment"
msgstr "Текст комментария" msgstr "Текст комментария"
#: models.py:118
#: models.py:150
msgid "Owner task" msgid "Owner task"
msgstr "Владелец задачи" msgstr "Владелец задачи"
#: models.py:119
#: models.py:154
msgid "Author" msgid "Author"
msgstr "Автор" msgstr "Автор"
#: models.py:120
#: models.py:157
msgid "Time of create" msgid "Time of create"
msgstr "Дата создания" msgstr "Дата создания"
#: models.py:130
#: models.py:167
msgid "Extra comment" msgid "Extra comment"
msgstr "Комментарий" msgstr "Комментарий"
#: models.py:131
#: models.py:168
msgid "Extra comments" msgid "Extra comments"
msgstr "Комментарии" msgstr "Комментарии"
@ -246,7 +246,7 @@ msgstr "Редактировать"
msgid "Create" msgid "Create"
msgstr "Создать" 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:115
#: templates/taskapp/tasklist_all.html:116 #: templates/taskapp/tasklist_all.html:116
msgid "Add new task" msgid "Add new task"
@ -261,21 +261,26 @@ msgstr "Редактировать задачу"
msgid "Find the subscriber" msgid "Find the subscriber"
msgstr "Найти абонента" msgstr "Найти абонента"
#: templates/taskapp/add_edit_task.html:86
#: templates/taskapp/add_edit_task.html:79
msgid "Save" msgid "Save"
msgstr "Сохранить" msgstr "Сохранить"
#: templates/taskapp/add_edit_task.html:89
#: templates/taskapp/add_edit_task.html:82
msgid "Reset" msgid "Reset"
msgstr "Сбросить" 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/extracomment_confirm_delete.html:15
#: templates/taskapp/comments/task_comments.html:12 #: templates/taskapp/comments/task_comments.html:12
#: templates/taskapp/tasklist_own.html:71 #: templates/taskapp/tasklist_own.html:71
msgid "Delete" msgid "Delete"
msgstr "Удалить" 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 #: templates/taskapp/comments/extracomment_confirm_delete.html:6
msgid "Delete comment" msgid "Delete comment"
msgstr "Удаление комментарий" msgstr "Удаление комментарий"
@ -331,39 +336,41 @@ msgstr "Тип задачи"
msgid "Attachment" msgid "Attachment"
msgstr "Приложение" msgstr "Приложение"
#: templates/taskapp/footer_btns.html:10
#: templates/taskapp/footer_btns.html:12
msgid "View all tasks" msgid "View all tasks"
msgstr "Просмотреть все задачи" 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" msgid "View empty tasks"
msgstr "Задачи без получателей" msgstr "Задачи без получателей"
#: templates/taskapp/notification.html:2 #: templates/taskapp/notification.html:2
msgid "" msgid ""
"\n" "\n"
" <pre>\n"
"%(task_status)s\n" "%(task_status)s\n"
" <a href=\"%(abon_url)s\">%(abon)s</a>\n"
"%(abon)s\n"
"In group: %(group)s\n" "In group: %(group)s\n"
"Street: %(street)s\n" "Street: %(street)s\n"
"House: %(house)s\n" "House: %(house)s\n"
"Tel: %(telephone)s\n" "Tel: %(telephone)s\n"
"Task type: %(task_type)s\n" "Task type: %(task_type)s\n"
" </pre>\n"
" <p>%(task_detail)s</p>\n"
"\n"
"%(task_detail)s\n"
msgstr "" msgstr ""
"\n" "\n"
" <pre>\n"
"%(task_status)s\n" "%(task_status)s\n"
" <a href=\"%(abon_url)s\">%(abon)s</a>\n"
"%(abon)s\n"
"Группа: %(group)s\n" "Группа: %(group)s\n"
"Улица: %(street)s\n" "Улица: %(street)s\n"
"Дом: %(house)s\n" "Дом: %(house)s\n"
"Телефон: %(telephone)s\n" "Телефон: %(telephone)s\n"
"Тип задачи: %(task_type)s\n" "Тип задачи: %(task_type)s\n"
" </pre>\n"
" <p>%(task_detail)s</p>\n"
"\n"
"%(task_detail)s\n"
#: templates/taskapp/tasklist.html:9 templates/taskapp/tasklist_all.html:25 #: templates/taskapp/tasklist.html:9 templates/taskapp/tasklist_all.html:25
msgid "Name and comment count" msgid "Name and comment count"
@ -404,10 +411,6 @@ msgstr "Сегодня"
msgid "Yesterday" msgid "Yesterday"
msgstr "Вчера" msgstr "Вчера"
#: templates/taskapp/tasklist.html:75 templates/taskapp/tasklist_failed.html:65
msgid "Complete"
msgstr "Завершить"
#: templates/taskapp/tasklist.html:78 #: templates/taskapp/tasklist.html:78
msgid "Mark as unsuccessful" msgid "Mark as unsuccessful"
msgstr "Отметить задачу как проваленную" msgstr "Отметить задачу как проваленную"
@ -460,31 +463,39 @@ msgstr "Автор не указан"
msgid "All your tasks has been performed" msgid "All your tasks has been performed"
msgstr "Все ваши задачи выполнены" msgstr "Все ваши задачи выполнены"
#: views.py:124
#: views.py:134
msgid "You cannot delete task that assigned to you" msgid "You cannot delete task that assigned to you"
msgstr "Вы не можете удалять назначенные на вас задачи" 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" msgid "Task has successfully created"
msgstr "Задача успешно создана" msgstr "Задача успешно создана"
#: views.py:177
#: views.py:205
msgid "Task has changed successfully" msgid "Task has changed successfully"
msgstr "Задача успешно изменена" msgstr "Задача успешно изменена"
#: views.py:197
#: views.py:225
msgid "time left" msgid "time left"
msgstr "Времени осталось" msgstr "Времени осталось"
#: views.py:199
#: views.py:227
#, python-format #, python-format
msgid "Expired timeout -%(time_left)s" msgid "Expired timeout -%(time_left)s"
msgstr "Время ожидания истекло -%(time_left)s" msgstr "Время ожидания истекло -%(time_left)s"
#: views.py:220
#: views.py:252
msgid "fix form errors" msgid "fix form errors"
msgstr "исправте ошибки формы" msgstr "исправте ошибки формы"
#: views.py:292
msgid "Task has been reminded"
msgstr "Напоминание о задаче отправлено"
msgid "Failed tasks" msgid "Failed tasks"
msgstr "Проваленные задачи" msgstr "Проваленные задачи"
@ -502,12 +513,3 @@ msgstr "Назначенные мной задачи"
msgid "Tasks to be performed" msgid "Tasks to be performed"
msgstr "Задачи, которые необходимо выполнить" 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 "Заявка для этого абонента уже создана. Вы перенаправлены к ней."

7
taskapp/templates/taskapp/notification.html

@ -1,13 +1,12 @@
{% load i18n %} {% 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 %} {% 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 %}
<pre>
{{ task_status }} {{ task_status }}
<a href="{{ abon_url }}">{{ abon }}</a>
{{ abon }}
In group: {{ group }} In group: {{ group }}
Street: {{ street }} Street: {{ street }}
House: {{ house }} House: {{ house }}
Tel: {{ telephone }} Tel: {{ telephone }}
Task type: {{ task_type }} Task type: {{ task_type }}
</pre>
<p>{{ task_detail }}</p>
{{ task_detail }}
{% endblocktrans %} {% endblocktrans %}
Loading…
Cancel
Save