Commit f02ce614e72b2f90ecbbb52830dcb94cace64fe9

Authored by fbormann
1 parent a58f106a

Fixed notification icon and added context-processor fully functional now, error …

…on login when using context-processor fixed #41
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
... ... @@ -21,6 +21,10 @@
21 21 transform:scale(1.1);
22 22 }
23 23  
  24 +.notification-count{
  25 + background-color: #cc0000;
  26 +}
  27 +
24 28 /* ID */
25 29  
26 30 .notifications{
... ...
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 %}
... ...