Commit a8a36303e598c55503924847bc491e2232fef642
1 parent
7099db9e
Exists in
master
and in
5 other branches
fixed notification decorator and mixin #53
Showing
3 changed files
with
6 additions
and
6 deletions
Show diff stats
core/decorators.py
... | ... | @@ -47,7 +47,7 @@ def log_decorator(log_action = '', log_resource = ''): |
47 | 47 | return _log_decorator |
48 | 48 | |
49 | 49 | |
50 | -def notification_decorator(read = False, message = '', actor = None, users = [], not_action='', not_resource=''): | |
50 | +def notification_decorator(read = False, message = '', actor = None, users = [], not_action='', not_resource='', resource_link=''): | |
51 | 51 | |
52 | 52 | def _notification_decorator(view_function): |
53 | 53 | |
... | ... | @@ -55,19 +55,19 @@ def notification_decorator(read = False, message = '', actor = None, users = [], |
55 | 55 | #Do something before the call |
56 | 56 | |
57 | 57 | response = view_function(request, *args, **kwargs) |
58 | - action = Action.objects.filter(name = self.not_action) | |
58 | + action = Action.objects.filter(name = not_action) | |
59 | 59 | resource = Resource.objects.filter(name = not_resource) |
60 | 60 | print(resource_link) |
61 | 61 | if action.exists(): |
62 | 62 | action = action[0] |
63 | 63 | else: |
64 | - action = Action(name = self.not_action) | |
64 | + action = Action(name = not_action) | |
65 | 65 | action.save() |
66 | 66 | |
67 | 67 | if resource.exists(): |
68 | 68 | resource = resource[0] |
69 | 69 | else: |
70 | - resource = Resource(name = self.not_resource, link= resource_link) | |
70 | + resource = Resource(name = not_resource, url= resource_link) | |
71 | 71 | print(resource) |
72 | 72 | resource.save() |
73 | 73 | ... | ... |
core/mixins.py
... | ... | @@ -57,7 +57,7 @@ class NotificationMixin(object): |
57 | 57 | if resource.exists(): |
58 | 58 | resource = resource[0] |
59 | 59 | else: |
60 | - resource = Resource(name = self.not_resource, link= resource_link) | |
60 | + resource = Resource(name = self.not_resource, url= resource_link) | |
61 | 61 | print(resource) |
62 | 62 | resource.save() |
63 | 63 | ... | ... |
courses/models.py