
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
django-dans-notifications
Advanced tools
A Django app to handle notifications.
Support for basic notifications, push notifications, and email notifications.
pip install django-dans-notifications
INSTALLED_APPS = [
...
'django_dans_notifications',
]
urls.py
for the REST API endpoints like this:path("api/notifications/", include("django_dans_notifications.urls")),
Run python manage.py migrate
to update your database schema.
Use the API endpoints, in code or your Django admin portal.
DEFAULT_AUTHENTICATION_CLASSES
and DEFAULT_PAGINATION_CLASS
in your settings.py
to work with the APIs properly. An example config would be:REST_FRAMEWORK = {
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
"PAGE_SIZE": 20,
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework.authentication.TokenAuthentication",
),
}
Currently all available settings are optional:
TEAM_NAME
- Default team name to use for emails, can be added to message context manually as well still.IN_TEST
- Whether running in tests or not. Used to determine whether to actually send email.Add these to your settings.py
file to customize the app's behavior like so:
TEAM_NAME = "My Team"
IN_TEST = True
get_notifications_push/email/basic/all
, mark_notification_basic_read
.The main way to interact with this app is to create and use the appropriate models and their managers' methods as needed.
Also included is the NotificationManager
class to expose some common functionality and maintain object permissions.
Some of its methods currently are:
get_notifications_push/email/basic/all
mark_notification_basic_read
You can also interact directly, so for example to send an email notification:
from django_dans_notifications.models.notifications import NotificationEmail
email_notification = NotificationEmail.objects.send_email(
subject="Hello",
template="django-dans-emails/default.html",
sender="sender@example.com",
recipients=["recipient@example.com"],
context={"user": "John Doe"},
file_attachment=None
)
FAQs
A Django app to handle basic notifications.
We found that django-dans-notifications demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.