From a18628bd4e9f1844019c5531a26a646df2d545c1 Mon Sep 17 00:00:00 2001 From: fbormann Date: Wed, 14 Sep 2016 01:30:12 -0300 Subject: [PATCH] Finally, I have finished the issue, completed the cycle and added url support, link now connects to another url and add read to True #41 --- amadeus/settings.py | 4 ++-- app/views.py | 2 +- core/mixins.py | 3 ++- core/templates/base.html | 6 +++--- core/urls.py | 1 + core/views.py | 10 +++++++++- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/amadeus/settings.py b/amadeus/settings.py index 6773eaa..ba3c3a3 100644 --- a/amadeus/settings.py +++ b/amadeus/settings.py @@ -92,8 +92,8 @@ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'amadeus', - 'USER': 'amadeus_admin', - 'PASSWORD': 'amadeus', + 'USER': 'postgres', + 'PASSWORD': 'felipe', 'HOST': '127.0.0.1', 'PORT': '5432', } diff --git a/app/views.py b/app/views.py index 2acb45c..be009f0 100644 --- a/app/views.py +++ b/app/views.py @@ -38,7 +38,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): if self.request.is_ajax(): self.template_name = "home_admin_content.html" - #super(AppIndex, self).createNotification("teste", not_resource="home", resource_link="users") + super(AppIndex, self).createNotification("teste", not_resource="home", resource_link="/register") notifications = Notification.objects.filter(user= self.request.user, read=False) context['notifications'] = notifications diff --git a/core/mixins.py b/core/mixins.py index 8f675d0..8fc2524 100644 --- a/core/mixins.py +++ b/core/mixins.py @@ -47,7 +47,7 @@ class NotificationMixin(object): def createNotification(self, message='', actor=None, users = User.objects.all(), not_action = '', not_resource='', resource_link=''): #the default will be a broadcast action = Action.objects.filter(name = self.not_action) resource = Resource.objects.filter(name = not_resource) - + print(resource_link) if action.exists(): action = action[0] else: @@ -58,6 +58,7 @@ class NotificationMixin(object): resource = resource[0] else: resource = Resource(name = self.not_resource, link= resource_link) + print(resource) resource.save() action_resource = Action_Resource.objects.filter(action = action, resource = resource) diff --git a/core/templates/base.html b/core/templates/base.html index 1a2752c..56e7d32 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -53,13 +53,13 @@