context_processors.py
823 Bytes
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
from datetime import datetime
from themes.models import Themes
from notifications.models import Notification
from mural.models import MuralVisualizations
def theme(request):
context = {}
theme = Themes.objects.get(id = 1)
context['theme'] = theme
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