context_processors.py
2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""
Copyright 2016, 2017 UFPE - Universidade Federal de Pernambuco
Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença.
Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes.
Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENSE", junto com este programa, se não, escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
"""
from datetime import datetime
from themes.models import Themes
from notifications.models import Notification
from mural.models import MuralVisualizations
from chat.models import ChatVisualizations
def theme(request):
context = {}
theme = Themes.objects.get(id = 1)
context['theme'] = theme
if ("contrast_check" in request.COOKIES.keys()):
context ['contrast_cookie'] = True
else:
context ['contrast_cookie'] = False
return context
def notifies(request):
context = {}
notifications = 0
if request.user.is_authenticated:
notifications = Notification.objects.filter(creation_date = datetime.now(), viewed = False, user = request.user).count()
context['notifications_count'] = notifications
return context
def mural_notifies(request):
context = {}
notifications = 0
if request.user.is_authenticated:
notifications = MuralVisualizations.objects.filter(viewed = False, user = request.user).count()
context['mural_notifications_count'] = notifications
return context
def chat_notifies(request):
context = {}
notifications = 0
if request.user.is_authenticated:
notifications = ChatVisualizations.objects.filter(viewed = False, user = request.user).count()
context['chat_notifications_count'] = notifications
return context