Django application allow to create site warnings, make subscription, and receive notifies.
Project description
django-site-warnings
Django application allow to create site warnings, make subscription, and receive notifies.
Install
pip install django-site-warnings
Usage
pro/views.py
from django_site_warnings.models import WaringCategory
from django_site_warnings.models import Warning
def background_sync_work(request):
try:
pass # do your own work
except Exception as error:
category = WaringCategory.get("warning category code")
Warning.make(category, f"background_sync_work failed: {error}")
pro/settings
INSTALLED_APPS = [
'...',
'django_site_warnings',
'...',
]
# work together with django-admin-global-sidebar
DJANGO_ADMIN_GLOBAL_SIDEBAR_MENUS = "pro.menus.site_menu"
# sendmail_notify settings
DJANGO_SITE_WARNING_SITE_NAME = "Site Warning"
DJANGO_SITE_WARNING_NOTIFY_MAIL_FROM = "sender@example.com"
DJANGO_SITE_WARNING_NOTIFY_MAIL_TO = ["receiver@example.com"]
DJANGO_SITE_WARNING_NOTIFY_MAIL_SERVER = "smtp.example.com"
DJANGO_SITE_WARNING_NOTIFY_MAIL_PORT = 465
DJANGO_SITE_WARNING_NOTIFY_MAIL_SSL = True
DJANGO_SITE_WARNING_NOTIFY_MAIL_USER = "sender@example.com"
DJANGO_SITE_WARNING_NOTIFY_MAIL_PASSWORD = "sender-password-MlPzC9kt"
pro/menus.py
from django_site_warnings.global_sidebar import django_site_warnings_menu_item_of_applist
def site_menu(request=None):
return [
{
"title": _("Home"),
"icon": "fa fa-home",
"url": "/admin/",
},
{
"title": _("System Settings"),
"icon": "fas fa-cogs",
"children": [
{
"title": _("User Manage"),
"icon": "fas fa-user",
"model": "auth.user",
"permissions": ["auth.view_user"],
},
{
"title": _("Group Manage"),
"icon": "fas fa-users",
"model": "auth.group",
"permissions": ["auth.view_group"],
},
django_site_warnings_menu_item_of_applist,
]
}
]
Releases
v0.1.2
- First release.
v0.1.4
- Make title length longer.
v0.1.6
- Test for Django 3.2.
- Work with django-simpletask2.
v0.2.0
- Add django_site_warnings.global_sidebar.django_site_warnings_menu_item_of_warning, django_site_warnings.global_sidebar.django_site_warnigns_menu_item_of_category and django_site_warnings.global_sidebar.django_site_warnings_menu_item_of_applist to work with django-admin-global-sidebar.
- WaringCategory.get will auto create category instance if it is missing.
- Register sendmail_notify to Warning by default.
v0.2.1
- Show notify send result.
v0.2.2
- Doc update.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-site-warnings-0.2.2.tar.gz
.
File metadata
- Download URL: django-site-warnings-0.2.2.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e128386bcdbdf684a06761d2b882916a72d611495d1aa1bfb6d7eb295c239eaa |
|
MD5 | 2a7b686a12fc9e267937b2b51ca6e5af |
|
BLAKE2b-256 | 2602e1b7c339e48ba8131c7f1532c8424627b3a4f1561358883f0325b0b8204a |
File details
Details for the file django_site_warnings-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: django_site_warnings-0.2.2-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b47cc7eada4ad8556097521166242b5e38bcd80b992610738d693a15099cc11 |
|
MD5 | bad434622897e113f104c001f083fc82 |
|
BLAKE2b-256 | 97334d1364e780d87d7b03b3ebeb9662fe076e237d205b398a8c221e7a6cdb79 |