Skip to main content

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.

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

django-site-warnings-0.2.1.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

django_site_warnings-0.2.1-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file django-site-warnings-0.2.1.tar.gz.

File metadata

  • Download URL: django-site-warnings-0.2.1.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for django-site-warnings-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6ab8992b9a149008f85978b132c509439cad7900c98a8b14cd3061c572a4371d
MD5 fe8b0092f8dbc4f25559370db59c6a4d
BLAKE2b-256 9ad5cb78911a42994a5c6cc3f1adde99d510958e55ef682570cb8a7e361166f5

See more details on using hashes here.

File details

Details for the file django_site_warnings-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: django_site_warnings-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for django_site_warnings-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 613b6c859652e884ac278e6f3bc5cb667184dad0349c97f14d29860ae5c5a2d3
MD5 aa5a933a02a0d7b1fac8b038df3804b0
BLAKE2b-256 1037b0dba10bae8cad7aa843bc9909d2a5292c1a99fda9248731f1d486055cc9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page