Commit d0356470525b7d173592f9082f870d2a7f915efb
Committed by
GitHub
Exists in
master
and in
2 other branches
Merge pull request #557 from amadeusproject/refactoring
Daily Update - 10_09_2017
Showing
35 changed files
with
182 additions
and
71 deletions
Show diff stats
amadeus/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
analytics/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
api/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
api/utils.py
... | ... | @@ -8,7 +8,7 @@ from fcm_django.fcm import fcm_send_message |
8 | 8 | |
9 | 9 | from chat.serializers import ChatSerializer |
10 | 10 | |
11 | -def sendChatPushNotification(user, message): | |
11 | +def sendChatPushNotification(user, message): | |
12 | 12 | device = FCMDevice.objects.filter(user = user, active = True).first() |
13 | 13 | |
14 | 14 | if not device is None: |
... | ... | @@ -39,4 +39,10 @@ def sendChatPushNotification(user, message): |
39 | 39 | if message.image: |
40 | 40 | simple_notify += " ".join(_("[Photo]")) |
41 | 41 | |
42 | - device.send_message(data = {"response": response, "title": title, "body": simple_notify, "user_from": message.user.email, "user_name": str(message.user), "user_img": message.user.image_url}) | |
43 | 42 | \ No newline at end of file |
43 | + device.send_message(data = {"response": response, "title": title, "body": simple_notify, "user_from": message.user.email, "user_name": str(message.user), "user_img": message.user.image_url, "type": 'chat'}) | |
44 | + | |
45 | +def sendMuralPushNotification(user, user_action, message): | |
46 | + device = FCMDevice.objects.filter(user = user, active = True).first() | |
47 | + | |
48 | + if not device is None: | |
49 | + device.send_message(data = {"title": "Mural", "body": message, "user_img": user_action.image_url, "type": "mural"}) | |
44 | 50 | \ No newline at end of file | ... | ... |
api/views.py
... | ... | @@ -65,7 +65,7 @@ def getToken(request): |
65 | 65 | } |
66 | 66 | |
67 | 67 | auth = (oauth.client_id, oauth.client_secret) |
68 | - | |
68 | + | |
69 | 69 | response = requests.post(request.build_absolute_uri(reverse('oauth2_provider:token')), data = data, auth = auth) |
70 | 70 | |
71 | 71 | json_r = json.loads(response.content.decode('utf-8')) |
... | ... | @@ -135,6 +135,8 @@ class LoginViewset(viewsets.ReadOnlyModelViewSet): |
135 | 135 | fcm_d.save() |
136 | 136 | |
137 | 137 | if not fcm_d.pk is None: |
138 | + FCMDevice.objects.filter(registration_id = device).exclude(pk = fcm_d.pk).update(active = False) | |
139 | + | |
138 | 140 | json_r["message"] = "" |
139 | 141 | json_r["type"] = "" |
140 | 142 | json_r["title"] = "" |
... | ... | @@ -169,7 +171,7 @@ class SubjectViewset(viewsets.ReadOnlyModelViewSet): |
169 | 171 | |
170 | 172 | subjects = Subject.objects.filter(Q(students__pk=pk) | Q(professor__pk=pk) | Q(category__coordinators__pk=pk)).distinct() |
171 | 173 | |
172 | - serializer = SubjectSerializer(subjects, many = True) | |
174 | + serializer = SubjectSerializer(subjects, many = True, context = {"request_user": user}) | |
173 | 175 | |
174 | 176 | json_r = json.dumps(serializer.data) |
175 | 177 | json_r = json.loads(json_r) |
... | ... | @@ -207,7 +209,7 @@ class ParticipantsViewset(viewsets.ReadOnlyModelViewSet): |
207 | 209 | if not subject_slug == "": |
208 | 210 | participants = User.objects.filter(Q(is_staff = True) | Q(subject_student__slug = subject_slug) | Q(professors__slug = subject_slug) | Q(coordinators__subject_category__slug = subject_slug)).exclude(email = username).distinct() |
209 | 211 | |
210 | - serializer = UserSerializer(participants, many = True) | |
212 | + serializer = UserSerializer(participants, many = True, context = {"request_user": username}) | |
211 | 213 | |
212 | 214 | json_r = json.dumps(serializer.data) |
213 | 215 | json_r = json.loads(json_r) | ... | ... |
bulletin/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -197,13 +197,13 @@ msgstr "A imagem não pode exceder 5MB." |
197 | 197 | |
198 | 198 | #: bulletin/templates/bulletin/send_message.html:62 |
199 | 199 | #: bulletin/templates/bulletin/view.html:235 |
200 | -#: bulletin/templates/bulletin/window_view.html:257 | |
200 | +#: bulletin/templates/bulletin/window_view.html:258 | |
201 | 201 | msgid "Close" |
202 | 202 | msgstr "Fechar" |
203 | 203 | |
204 | 204 | #: bulletin/templates/bulletin/send_message.html:63 |
205 | 205 | #: bulletin/templates/bulletin/view.html:236 |
206 | -#: bulletin/templates/bulletin/window_view.html:258 | |
206 | +#: bulletin/templates/bulletin/window_view.html:259 | |
207 | 207 | msgid "Send" |
208 | 208 | msgstr "Enviar" |
209 | 209 | |
... | ... | @@ -212,22 +212,22 @@ msgid "Edit: " |
212 | 212 | msgstr "Editar: " |
213 | 213 | |
214 | 214 | #: bulletin/templates/bulletin/view.html:215 |
215 | -#: bulletin/templates/bulletin/window_view.html:237 | |
215 | +#: bulletin/templates/bulletin/window_view.html:238 | |
216 | 216 | msgid "There are obstructions to your activities?" |
217 | 217 | msgstr "Existem impedimentos para as suas atividades?" |
218 | 218 | |
219 | 219 | #: bulletin/templates/bulletin/view.html:216 |
220 | -#: bulletin/templates/bulletin/window_view.html:238 | |
220 | +#: bulletin/templates/bulletin/window_view.html:239 | |
221 | 221 | msgid "Click here" |
222 | 222 | msgstr "Clique aqui" |
223 | 223 | |
224 | 224 | #: bulletin/templates/bulletin/view.html:216 |
225 | -#: bulletin/templates/bulletin/window_view.html:238 | |
225 | +#: bulletin/templates/bulletin/window_view.html:239 | |
226 | 226 | msgid "to communicate the difficulties that may decrease your performance." |
227 | 227 | msgstr "para informar as dificuldades que podem prejudicar seu desempenho." |
228 | 228 | |
229 | 229 | #: bulletin/templates/bulletin/view.html:231 |
230 | -#: bulletin/templates/bulletin/window_view.html:253 | |
230 | +#: bulletin/templates/bulletin/window_view.html:254 | |
231 | 231 | msgid "Type here the dificulties that may harm your performance" |
232 | 232 | msgstr "Escreva aqui as dificuldades que podem diminuir sua performance" |
233 | 233 | ... | ... |
categories/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
chat/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
dashboards/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
file_link/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -96,6 +96,10 @@ msgstr "Ação não realizada pelo usuário" |
96 | 96 | msgid "Wished period" |
97 | 97 | msgstr "Período desejado" |
98 | 98 | |
99 | +#: file_link/templates/file_links/_form.html:237 | |
100 | +msgid "Students" | |
101 | +msgstr "" | |
102 | + | |
99 | 103 | #: file_link/templates/file_links/_form.html:267 |
100 | 104 | msgid "Attribute students to file link" |
101 | 105 | msgstr "Atribuir estudantes ao Link para Arquivo" | ... | ... |
goals/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
links/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -62,6 +62,10 @@ msgstr "Ação não realizada pelo usuário" |
62 | 62 | msgid "Wished period" |
63 | 63 | msgstr "Período desejado" |
64 | 64 | |
65 | +#: links/templates/links/_form.html:222 | |
66 | +msgid "Students" | |
67 | +msgstr "" | |
68 | + | |
65 | 69 | #: links/templates/links/_form.html:252 |
66 | 70 | msgid "Attribute students to file link" |
67 | 71 | msgstr "Atribuir estudantes para o link de arquivo" | ... | ... |
log/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
mailsender/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
mural/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -322,7 +322,7 @@ msgstr "Grupos" |
322 | 322 | #: mural/templates/mural/resource_view.html:12 |
323 | 323 | #: mural/templates/mural/resource_view.html:29 |
324 | 324 | #: mural/templates/mural/subject_view.html:9 |
325 | -#: mural/templates/mural/subject_view.html:27 mural/views.py:101 | |
325 | +#: mural/templates/mural/subject_view.html:27 mural/views.py:103 | |
326 | 326 | msgid "Mural" |
327 | 327 | msgstr "Mural" |
328 | 328 | |
... | ... | @@ -334,11 +334,11 @@ msgstr "" |
334 | 334 | msgid "(Edited)" |
335 | 335 | msgstr "(Editado)" |
336 | 336 | |
337 | -#: mural/templatetags/mural_filters.py:35 mural/views.py:1226 | |
337 | +#: mural/templatetags/mural_filters.py:35 mural/views.py:1240 | |
338 | 338 | msgid "Unfavorite" |
339 | 339 | msgstr "Desfavoritar" |
340 | 340 | |
341 | -#: mural/templatetags/mural_filters.py:37 mural/views.py:1230 | |
341 | +#: mural/templatetags/mural_filters.py:37 mural/views.py:1244 | |
342 | 342 | msgid "Favorite" |
343 | 343 | msgstr "Favoritar" |
344 | 344 | |
... | ... | @@ -358,63 +358,63 @@ msgstr "" |
358 | 358 | msgid "Offline" |
359 | 359 | msgstr "" |
360 | 360 | |
361 | -#: mural/views.py:154 | |
361 | +#: mural/views.py:151 | |
362 | 362 | #, python-format |
363 | 363 | msgid "%s has made a post in General" |
364 | 364 | msgstr "%s postou em Geral" |
365 | 365 | |
366 | -#: mural/views.py:258 mural/views.py:522 mural/views.py:858 | |
366 | +#: mural/views.py:263 mural/views.py:530 mural/views.py:869 | |
367 | 367 | msgid "Are you sure you want to delete this post?" |
368 | 368 | msgstr "Você tem certeza que deseja deletar essa postagem?" |
369 | 369 | |
370 | -#: mural/views.py:366 | |
370 | +#: mural/views.py:371 | |
371 | 371 | msgid "Mural - Per Category" |
372 | 372 | msgstr "Mural - Por Categoria" |
373 | 373 | |
374 | -#: mural/views.py:411 mural/views.py:717 mural/views.py:1152 | |
374 | +#: mural/views.py:411 mural/views.py:720 mural/views.py:1158 | |
375 | 375 | #, python-format |
376 | 376 | msgid "%s has made a post in %s" |
377 | 377 | msgstr "%s postou em %s" |
378 | 378 | |
379 | -#: mural/views.py:655 | |
379 | +#: mural/views.py:663 | |
380 | 380 | msgid "Mural - Per Subject" |
381 | 381 | msgstr "Mural - Por Assunto" |
382 | 382 | |
383 | -#: mural/views.py:969 mural/views.py:1085 | |
383 | +#: mural/views.py:980 mural/views.py:1096 | |
384 | 384 | #, python-format |
385 | 385 | msgid "%s - Mural" |
386 | 386 | msgstr "%s - Mural" |
387 | 387 | |
388 | -#: mural/views.py:1207 | |
388 | +#: mural/views.py:1221 | |
389 | 389 | msgid "Your post was published successfully!" |
390 | 390 | msgstr "Sua postagem foi publicada com sucesso!" |
391 | 391 | |
392 | -#: mural/views.py:1209 | |
392 | +#: mural/views.py:1223 | |
393 | 393 | msgid "Your post was edited successfully!" |
394 | 394 | msgstr "Sua postagem foi editada com sucesso!" |
395 | 395 | |
396 | -#: mural/views.py:1216 | |
396 | +#: mural/views.py:1230 | |
397 | 397 | msgid "Post deleted successfully!" |
398 | 398 | msgstr "Postagem deletada com sucesso!" |
399 | 399 | |
400 | -#: mural/views.py:1284 | |
400 | +#: mural/views.py:1293 | |
401 | 401 | #, python-format |
402 | 402 | msgid "%s has commented in a post" |
403 | 403 | msgstr "%s comentou em um postagem" |
404 | 404 | |
405 | -#: mural/views.py:1443 | |
405 | +#: mural/views.py:1460 | |
406 | 406 | msgid "Are you sure you want to delete this comment?" |
407 | 407 | msgstr "Você tem certeza que deseja deletar esse comentário?" |
408 | 408 | |
409 | -#: mural/views.py:1510 | |
409 | +#: mural/views.py:1527 | |
410 | 410 | msgid "Your comment was published successfully!" |
411 | 411 | msgstr "Seu comentário foi publicado com sucesso!" |
412 | 412 | |
413 | -#: mural/views.py:1512 | |
413 | +#: mural/views.py:1529 | |
414 | 414 | msgid "Your comment was edited successfully!" |
415 | 415 | msgstr "Seu comentário foi editado com sucesso!" |
416 | 416 | |
417 | -#: mural/views.py:1519 | |
417 | +#: mural/views.py:1536 | |
418 | 418 | msgid "Comment deleted successfully!" |
419 | 419 | msgstr "Comentário deletado com sucesso!" |
420 | 420 | ... | ... |
mural/views.py
... | ... | @@ -25,6 +25,8 @@ from log.decorators import log_decorator, log_decorator_ajax |
25 | 25 | import time |
26 | 26 | from datetime import datetime |
27 | 27 | |
28 | +from api.utils import sendMuralPushNotification | |
29 | + | |
28 | 30 | from .models import Mural, GeneralPost, CategoryPost, SubjectPost, MuralVisualizations, MuralFavorites, Comment |
29 | 31 | from .forms import GeneralPostForm, CategoryPostForm, SubjectPostForm, ResourcePostForm, CommentForm |
30 | 32 | from .utils import getSpaceUsers |
... | ... | @@ -146,12 +148,14 @@ class GeneralCreate(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
146 | 148 | |
147 | 149 | paths = [reverse("mural:manage_general")] |
148 | 150 | |
151 | + simple_notify = _("%s has made a post in General")%(str(self.object.user)) | |
152 | + | |
149 | 153 | notification = { |
150 | 154 | "type": "mural", |
151 | 155 | "subtype": "post", |
152 | 156 | "paths": paths, |
153 | 157 | "user_icon": self.object.user.image_url, |
154 | - "simple_notify": _("%s has made a post in General")%(str(self.object.user)), | |
158 | + "simple_notify": simple_notify, | |
155 | 159 | "complete": render_to_string("mural/_view.html", {"post": self.object}, self.request), |
156 | 160 | "container": ".post", |
157 | 161 | "accordion": False, |
... | ... | @@ -162,6 +166,7 @@ class GeneralCreate(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
162 | 166 | |
163 | 167 | for user in users: |
164 | 168 | entries.append(MuralVisualizations(viewed = False, user = user, post = self.object)) |
169 | + sendMuralPushNotification(user, self.object.user, simple_notify) | |
165 | 170 | Group("user-%s" % user.id).send({'text': notification}) |
166 | 171 | |
167 | 172 | MuralVisualizations.objects.bulk_create(entries) |
... | ... | @@ -403,12 +408,14 @@ class CategoryCreate(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
403 | 408 | |
404 | 409 | paths = [reverse("mural:manage_category")] |
405 | 410 | |
411 | + simple_notify = _("%s has made a post in %s")%(str(self.object.user), str(self.object.space)) | |
412 | + | |
406 | 413 | notification = { |
407 | 414 | "type": "mural", |
408 | 415 | "subtype": "post", |
409 | 416 | "paths": paths, |
410 | 417 | "user_icon": self.object.user.image_url, |
411 | - "simple_notify": _("%s has made a post in %s")%(str(self.object.user), str(self.object.space)), | |
418 | + "simple_notify": simple_notify, | |
412 | 419 | "complete": render_to_string("mural/_view.html", {"post": self.object}, self.request), |
413 | 420 | "container": "#" + slug, |
414 | 421 | "accordion": True, |
... | ... | @@ -419,6 +426,7 @@ class CategoryCreate(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
419 | 426 | |
420 | 427 | for user in users: |
421 | 428 | entries.append(MuralVisualizations(viewed = False, user = user, post = self.object)) |
429 | + sendMuralPushNotification(user, self.object.user, simple_notify) | |
422 | 430 | Group("user-%s" % user.id).send({'text': notification}) |
423 | 431 | |
424 | 432 | MuralVisualizations.objects.bulk_create(entries) |
... | ... | @@ -709,12 +717,14 @@ class SubjectCreate(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
709 | 717 | if self.object.resource: |
710 | 718 | paths.append(reverse("mural:resource_view", args = (), kwargs = {'slug': self.object.resource.slug})) |
711 | 719 | |
720 | + simple_notify = _("%s has made a post in %s")%(str(self.object.user), str(self.object.space)) | |
721 | + | |
712 | 722 | notification = { |
713 | 723 | "type": "mural", |
714 | 724 | "subtype": "post", |
715 | 725 | "paths": paths, |
716 | 726 | "user_icon": self.object.user.image_url, |
717 | - "simple_notify": _("%s has made a post in %s")%(str(self.object.user), str(self.object.space)), | |
727 | + "simple_notify": simple_notify, | |
718 | 728 | "complete": render_to_string("mural/_view.html", {"post": self.object}, self.request), |
719 | 729 | "container": "#" + slug, |
720 | 730 | "accordion": True, |
... | ... | @@ -725,6 +735,7 @@ class SubjectCreate(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
725 | 735 | |
726 | 736 | for user in users: |
727 | 737 | entries.append(MuralVisualizations(viewed = False, user = user, post = self.object)) |
738 | + sendMuralPushNotification(user, self.object.user, simple_notify) | |
728 | 739 | Group("user-%s" % user.id).send({'text': notification}) |
729 | 740 | |
730 | 741 | MuralVisualizations.objects.bulk_create(entries) |
... | ... | @@ -1144,12 +1155,14 @@ class ResourceCreate(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
1144 | 1155 | if self.object.resource: |
1145 | 1156 | paths.append(reverse("mural:resource_view", args = (), kwargs = {'slug': self.object.resource.slug})) |
1146 | 1157 | |
1158 | + simple_notify = _("%s has made a post in %s")%(str(self.object.user), str(self.object.space)) | |
1159 | + | |
1147 | 1160 | notification = { |
1148 | 1161 | "type": "mural", |
1149 | 1162 | "subtype": "post", |
1150 | 1163 | "paths": paths, |
1151 | 1164 | "user_icon": self.object.user.image_url, |
1152 | - "simple_notify": _("%s has made a post in %s")%(str(self.object.user), str(self.object.space)), | |
1165 | + "simple_notify": simple_notify, | |
1153 | 1166 | "complete": render_to_string("mural/_view.html", {"post": self.object}, self.request), |
1154 | 1167 | "container": "#" + slug, |
1155 | 1168 | "accordion": True, |
... | ... | @@ -1160,6 +1173,7 @@ class ResourceCreate(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
1160 | 1173 | |
1161 | 1174 | for user in users: |
1162 | 1175 | entries.append(MuralVisualizations(viewed = False, user = user, post = self.object)) |
1176 | + sendMuralPushNotification(user, self.object.user, simple_notify) | |
1163 | 1177 | Group("user-%s" % user.id).send({'text': notification}) |
1164 | 1178 | |
1165 | 1179 | MuralVisualizations.objects.bulk_create(entries) |
... | ... | @@ -1276,12 +1290,14 @@ class CommentCreate(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
1276 | 1290 | if post.subjectpost.resource: |
1277 | 1291 | paths.append(reverse("mural:resource_view", args = (), kwargs = {'slug': post.subjectpost.resource.slug})) |
1278 | 1292 | |
1293 | + simple_notify = _("%s has commented in a post")%(str(self.object.user)) | |
1294 | + | |
1279 | 1295 | notification = { |
1280 | 1296 | "type": "mural", |
1281 | 1297 | "subtype": "comment", |
1282 | 1298 | "paths": paths, |
1283 | 1299 | "user_icon": self.object.user.image_url, |
1284 | - "simple_notify": _("%s has commented in a post")%(str(self.object.user)), | |
1300 | + "simple_notify": simple_notify, | |
1285 | 1301 | "complete": render_to_string("mural/_view_comment.html", {"comment": self.object}, self.request), |
1286 | 1302 | "container": "#post-" + str(post.get_id()), |
1287 | 1303 | "post_type": post._my_subclass, |
... | ... | @@ -1292,6 +1308,7 @@ class CommentCreate(LoginRequiredMixin, LogMixin, generic.edit.CreateView): |
1292 | 1308 | |
1293 | 1309 | for user in users: |
1294 | 1310 | entries.append(MuralVisualizations(viewed = False, user = user, comment = self.object)) |
1311 | + sendMuralPushNotification(user, self.object.user, simple_notify) | |
1295 | 1312 | Group("user-%s" % user.id).send({'text': notification}) |
1296 | 1313 | |
1297 | 1314 | MuralVisualizations.objects.bulk_create(entries) | ... | ... |
news/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
notifications/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
notifications/utils.py
... | ... | @@ -9,6 +9,9 @@ from log.models import Log |
9 | 9 | from pendencies.models import Pendencies |
10 | 10 | from users.models import User |
11 | 11 | |
12 | +from fcm_django.models import FCMDevice | |
13 | +from fcm_django.fcm import fcm_send_message | |
14 | + | |
12 | 15 | from .models import Notification |
13 | 16 | |
14 | 17 | def get_resource_users(resource): |
... | ... | @@ -17,6 +20,18 @@ def get_resource_users(resource): |
17 | 20 | |
18 | 21 | return User.objects.filter(Q(resource_students = resource) | Q(group_participants__resource_groups = resource)).distinct() |
19 | 22 | |
23 | +def notificate(): | |
24 | + users = User.objects.all() | |
25 | + | |
26 | + for user in users: | |
27 | + notifications = Notification.objects.filter(user = user, viewed = False, creation_date = timezone.now()).count() | |
28 | + | |
29 | + if notifications > 0: | |
30 | + device = FCMDevice.objects.filter(user = user, active = True).first() | |
31 | + | |
32 | + if not device is None: | |
33 | + device.send_message(data = {"body": notifications, "type": "pendency"}) | |
34 | + | |
20 | 35 | def set_notifications(): |
21 | 36 | pendencies = Pendencies.objects.filter(begin_date__date__lte = timezone.now(), resource__visible = True) |
22 | 37 | |
... | ... | @@ -65,6 +80,8 @@ def set_notifications(): |
65 | 80 | |
66 | 81 | notification.save() |
67 | 82 | |
83 | + notificate() | |
84 | + | |
68 | 85 | def get_order_by(order): |
69 | 86 | if order is None or order == "": |
70 | 87 | return ["-creation_date"] | ... | ... |
pdf_file/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -84,6 +84,10 @@ msgstr "Ação não permitida pelo usuário" |
84 | 84 | msgid "Wished period" |
85 | 85 | msgstr "Período desejado" |
86 | 86 | |
87 | +#: pdf_file/templates/pdf_file/_form.html:239 | |
88 | +msgid "Students" | |
89 | +msgstr "" | |
90 | + | |
87 | 91 | #: pdf_file/templates/pdf_file/_form.html:269 |
88 | 92 | msgid "Attribute students to file link" |
89 | 93 | msgstr "" | ... | ... |
pendencies/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
reports/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
security/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
students_group/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -38,7 +38,8 @@ msgstr "Descrição" |
38 | 38 | msgid "Subject" |
39 | 39 | msgstr "Assunto" |
40 | 40 | |
41 | -#: students_group/models.py:13 students_group/templates/groups/index.html:75 | |
41 | +#: students_group/models.py:13 students_group/templates/groups/_form.html:14 | |
42 | +#: students_group/templates/groups/index.html:75 | |
42 | 43 | msgid "Participants" |
43 | 44 | msgstr "Participantes" |
44 | 45 | ... | ... |
subjects/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -86,7 +86,7 @@ msgstr "Início de inscrição" |
86 | 86 | msgid "End Subscribe" |
87 | 87 | msgstr "Encerramento de inscrição" |
88 | 88 | |
89 | -#: subjects/models.py:42 | |
89 | +#: subjects/models.py:42 subjects/templates/subjects/_form.html:14 | |
90 | 90 | msgid "Students" |
91 | 91 | msgstr "Estudantes" |
92 | 92 | |
... | ... | @@ -98,6 +98,12 @@ msgstr "Tamanho máximo de upload" |
98 | 98 | msgid "Attribute students to subject" |
99 | 99 | msgstr "Atribuir estudantes ao assunto" |
100 | 100 | |
101 | +#: subjects/templates/subjects/_form.html:34 | |
102 | +#, fuzzy | |
103 | +#| msgid "Professor(s) " | |
104 | +msgid "Professor" | |
105 | +msgstr "Professor(es) " | |
106 | + | |
101 | 107 | #: subjects/templates/subjects/_form.html:41 |
102 | 108 | msgid "Attribute professors to subject" |
103 | 109 | msgstr "Atribuir professores ao assunto" |
... | ... | @@ -146,7 +152,7 @@ msgstr "Grupos" |
146 | 152 | #: subjects/templates/subjects/restore.html:16 |
147 | 153 | #: subjects/templates/subjects/restore.html:44 |
148 | 154 | #: subjects/templates/subjects/restore.html:59 |
149 | -#: subjects/templates/subjects/restore.html:92 | |
155 | +#: subjects/templates/subjects/restore.html:102 | |
150 | 156 | #: subjects/templates/subjects/subject_card.html:34 |
151 | 157 | #: subjects/templates/subjects/view.html:56 |
152 | 158 | msgid "Restore" |
... | ... | @@ -286,6 +292,10 @@ msgstr "Escolha seu arquivo..." |
286 | 292 | msgid "Click or drop the file here" |
287 | 293 | msgstr "Clique ou solte o arquivo aqui" |
288 | 294 | |
295 | +#: subjects/templates/subjects/restore.html:96 | |
296 | +msgid "File not supported." | |
297 | +msgstr "" | |
298 | + | |
289 | 299 | #: subjects/templates/subjects/subject_card.html:39 |
290 | 300 | #: subjects/templates/subjects/view.html:61 |
291 | 301 | msgid "Analytics" | ... | ... |
subjects/serializers.py
1 | +import datetime | |
2 | +from django.db.models import Q | |
3 | + | |
1 | 4 | from rest_framework import serializers |
2 | 5 | |
6 | +from chat.models import ChatVisualizations | |
7 | + | |
3 | 8 | from .models import Subject, Tag |
4 | 9 | |
5 | 10 | class TagSerializer(serializers.ModelSerializer): |
... | ... | @@ -24,7 +29,16 @@ class TagSerializer(serializers.ModelSerializer): |
24 | 29 | validators = [] |
25 | 30 | |
26 | 31 | class SubjectSerializer(serializers.ModelSerializer): |
32 | + notifications = serializers.SerializerMethodField() | |
33 | + | |
34 | + def get_notifications(self, subject): | |
35 | + user = self.context.get("request_user", None) | |
36 | + | |
37 | + if not user is None: | |
38 | + return ChatVisualizations.objects.filter(Q(user = user) & Q(viewed = False) & Q(message__subject = subject) & (Q(user__is_staff = True) | Q(message__subject__students = user) | Q(message__subject__professor = user) | Q(message__subject__category__coordinators = user))).distinct().count() | |
39 | + | |
40 | + return 0 | |
27 | 41 | |
28 | 42 | class Meta: |
29 | 43 | model = Subject |
30 | - fields = ["name", "slug", "visible", "description_brief", "description"] | |
31 | 44 | \ No newline at end of file |
45 | + fields = ["name", "slug", "visible", "description_brief", "description", "notifications"] | |
32 | 46 | \ No newline at end of file | ... | ... |
themes/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
topics/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
users/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
users/serializers.py
1 | 1 | import os |
2 | 2 | import zipfile |
3 | 3 | import time |
4 | +from django.db.models import Q | |
4 | 5 | from django.conf import settings |
5 | 6 | from django.core.files import File |
7 | + | |
6 | 8 | from rest_framework import serializers |
7 | 9 | |
8 | 10 | from log.serializers import LogSerializer |
9 | 11 | from log.models import Log |
10 | 12 | |
13 | +from chat.models import Conversation, ChatVisualizations | |
14 | + | |
11 | 15 | from .models import User |
12 | 16 | |
13 | 17 | class UserBackupSerializer(serializers.ModelSerializer): |
... | ... | @@ -58,7 +62,22 @@ class UserBackupSerializer(serializers.ModelSerializer): |
58 | 62 | validators = [] |
59 | 63 | |
60 | 64 | class UserSerializer(serializers.ModelSerializer): |
65 | + unseen_msgs = serializers.SerializerMethodField() | |
66 | + | |
67 | + def get_unseen_msgs(self, user_to): | |
68 | + user = self.context.get('request_user', None) | |
69 | + | |
70 | + if not user is None: | |
71 | + chat = Conversation.objects.filter((Q(user_one__email = user) & Q(user_two = user_to)) | (Q(user_one = user_to) & Q(user_two__email = user))) | |
72 | + | |
73 | + if chat.count() > 0: | |
74 | + chat = chat[0] | |
75 | + | |
76 | + return ChatVisualizations.objects.filter(message__talk = chat, user__email = user, viewed = False).count() | |
77 | + | |
78 | + return 0 | |
79 | + | |
61 | 80 | class Meta: |
62 | 81 | model = User |
63 | 82 | fields = ('username','email','image_url','last_update','date_created','last_name','social_name', |
64 | - 'is_staff','is_active','description') | |
83 | + 'is_staff','is_active','description','unseen_msgs') | ... | ... |
webconference/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -97,6 +97,10 @@ msgstr "Ação não executada pelo usuário" |
97 | 97 | msgid "Wished period" |
98 | 98 | msgstr "Período desejado" |
99 | 99 | |
100 | +#: webconference/templates/webconference/_form.html:253 | |
101 | +msgid "Students" | |
102 | +msgstr "" | |
103 | + | |
100 | 104 | #: webconference/templates/webconference/_form.html:283 |
101 | 105 | msgid "Attribute students to Web Conference" |
102 | 106 | msgstr "Atribuir alunos à web conferência" | ... | ... |
webpage/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -78,6 +78,10 @@ msgstr "Ação não realizada pelo usuário" |
78 | 78 | msgid "Wished period" |
79 | 79 | msgstr "Período desejado" |
80 | 80 | |
81 | +#: webpage/templates/webpages/_form.html:206 | |
82 | +msgid "Students" | |
83 | +msgstr "" | |
84 | + | |
81 | 85 | #: webpage/templates/webpages/_form.html:236 |
82 | 86 | msgid "Attribute students to webpage" |
83 | 87 | msgstr "Atribuir estudantes à Página Web" | ... | ... |
youtube_video/forms.py
... | ... | @@ -69,11 +69,13 @@ class YTVideoForm(forms.ModelForm): |
69 | 69 | |
70 | 70 | def clean_url(self): |
71 | 71 | url = self.cleaned_data.get('url', '') |
72 | - if not 'youtube' in url or re.compile('[htps:/]*w*\.youtube\.com/?').fullmatch(url) or requests.get(url).status_code == 404: | |
72 | + if url[0].lower() != "h": url = "https://" + url | |
73 | + if (re.compile("https?://w{3}\.youtube\.com/").match(url) == None | |
74 | + and re.compile("https?://youtu\.be/").match(url) == None) or requests.get(url).status_code == 404: | |
73 | 75 | self._errors['url'] = [_('Invalid URL. It should be an YouTube link.')] |
74 | - | |
75 | 76 | return ValueError |
76 | - | |
77 | + if re.compile("https?://youtu\.be/").match(url) != None: | |
78 | + url = url.replace("youtu.be","www.youtube.com/embed") | |
77 | 79 | return url |
78 | 80 | |
79 | 81 | def save(self, commit = True): | ... | ... |
youtube_video/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-09-07 22:29-0300\n" | |
11 | +"POT-Creation-Date: 2017-09-10 02:55-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -30,7 +30,7 @@ msgstr "Título do Vídeo" |
30 | 30 | msgid "This subject already has a resource with this name" |
31 | 31 | msgstr "Esse assunto já possui um recurso com esse nome" |
32 | 32 | |
33 | -#: youtube_video/forms.py:73 | |
33 | +#: youtube_video/forms.py:75 | |
34 | 34 | msgid "Invalid URL. It should be an YouTube link." |
35 | 35 | msgstr "URL inválida. Ela deve ser uma URL de um vídeo do YouTube." |
36 | 36 | |
... | ... | @@ -66,6 +66,10 @@ msgstr "Ação não realizada pelo usuário" |
66 | 66 | msgid "Wished period" |
67 | 67 | msgstr "Período desejado" |
68 | 68 | |
69 | +#: youtube_video/templates/youtube/_form.html:212 | |
70 | +msgid "Students" | |
71 | +msgstr "" | |
72 | + | |
69 | 73 | #: youtube_video/templates/youtube/_form.html:242 |
70 | 74 | msgid "Attribute students to YouTube Video" |
71 | 75 | msgstr "Atribuir estudantes ao Vídeo do YouTube" | ... | ... |
youtube_video/models.py
... | ... | @@ -5,7 +5,7 @@ from django.core.urlresolvers import reverse_lazy |
5 | 5 | from topics.models import Resource |
6 | 6 | |
7 | 7 | class YTVideo(Resource): |
8 | - url = models.URLField(_('URL'), max_length = 250) | |
8 | + url = models.CharField(_('URL'), max_length = 250) | |
9 | 9 | |
10 | 10 | class Meta: |
11 | 11 | verbose_name = _('YTVideo') |
... | ... | @@ -37,4 +37,3 @@ class YTVideo(Resource): |
37 | 37 | return "https://www.youtube.com/embed/" + parts[1] |
38 | 38 | |
39 | 39 | return self.url |
40 | - | ... | ... |