Commit f02ce614e72b2f90ecbbb52830dcb94cace64fe9
1 parent
a58f106a
Exists in
master
and in
5 other branches
Fixed notification icon and added context-processor fully functional now, error …
…on login when using context-processor fixed #41
Showing
4 changed files
with
13 additions
and
6 deletions
Show diff stats
amadeus/settings.py
... | ... | @@ -94,8 +94,8 @@ DATABASES = { |
94 | 94 | 'default': { |
95 | 95 | 'ENGINE': 'django.db.backends.postgresql', |
96 | 96 | 'NAME': 'amadeus', |
97 | - 'USER': 'amadeus_admin', | |
98 | - 'PASSWORD': 'amadeus', | |
97 | + 'USER': 'postgres', | |
98 | + 'PASSWORD': 'felipe', | |
99 | 99 | 'HOST': '127.0.0.1', |
100 | 100 | 'PORT': '5432', |
101 | 101 | } | ... | ... |
core/context_processors.py
1 | 1 | from .models import Notification |
2 | 2 | |
3 | 3 | def notifications(request): |
4 | - return { | |
5 | - 'notifications': Notifications.objects.filter(user= request.user, read=False).order_by('-datetime') | |
6 | - } | |
7 | 4 | \ No newline at end of file |
5 | + if request.user.is_authenticated: | |
6 | + return { | |
7 | + 'notifications': Notification.objects.filter(user= request.user, read=False).order_by('-datetime') | |
8 | + } | |
9 | + else: | |
10 | + return request | |
8 | 11 | \ No newline at end of file | ... | ... |
core/static/css/base/header.css
core/templates/base.html
... | ... | @@ -53,7 +53,7 @@ |
53 | 53 | <div class="navbar-collapse collapse navbar-responsive-collapse"> |
54 | 54 | <ul class="nav navbar-nav navbar-right notifications"> |
55 | 55 | <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications"> |
56 | - <a class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bell-o" aria-hidden="true"></i></a> | |
56 | + <a class="dropdown-toggle" data-toggle="dropdown"> <span class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell-o" aria-hidden="true"></i></a> | |
57 | 57 | <ul class="dropdown-menu"> |
58 | 58 | <li class="dropdown-header">Notifications</li> |
59 | 59 | {% for notification in notifications %} | ... | ... |