Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djangoldp-notification
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
djangoldp-packages
djangoldp-notification
Commits
6569dd63
Commit
6569dd63
authored
6 years ago
by
Jean-Baptiste
Browse files
Options
Downloads
Patches
Plain Diff
update: send email on new notification
parent
43757c07
No related branches found
Branches containing commit
Tags
v0.0.14
Tags containing commit
No related merge requests found
Pipeline
#1494
passed
6 years ago
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
djangoldp_notification/models.py
+8
-1
8 additions, 1 deletion
djangoldp_notification/models.py
with
8 additions
and
1 deletion
djangoldp_notification/models.py
+
8
−
1
View file @
6569dd63
...
...
@@ -5,6 +5,7 @@ import requests
from
django.conf
import
settings
from
django.contrib.admin.models
import
LogEntry
from
django.contrib.sessions.models
import
Session
from
django.core.mail
import
send_mail
from
django.db
import
models
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
...
...
@@ -29,7 +30,7 @@ class Notification(Model):
(
'
view_notification
'
,
'
Read
'
),
(
'
control_notification
'
,
'
Control
'
),
)
permission_classes
=
[
InboxPermissions
]
permission_classes
=
[
InboxPermissions
]
ordering
=
[
'
date
'
]
def
__str__
(
self
):
...
...
@@ -71,3 +72,9 @@ def send_request(target, object_iri):
except
:
logging
.
error
(
'
Djangoldp_notifications: Error with request
'
)
return
True
@receiver
(
post_save
,
sender
=
Notification
)
def
send_email_on_notification
(
sender
,
instance
,
**
kwargs
):
send_mail
(
'
Notification on staging.happy-dev.fr
'
,
instance
.
summary
,
'
from@example.com
'
,
[
instance
.
user
.
email
],
fail_silently
=
False
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment