django-top-notify

license Release Version

A top notification bar based on Django project.

Feature

  • Integrate into an existing Django project easily.
  • Support hint and alert type of top notification.
  • Publish and cancel top notification dynamically without deployment.
  • Latest notification will automatically be displayed.

Demo

  • Publish or cancel

    Use Django Admin page to configure:

    configuration.png

  • Hint top notification

    hint_top_notification.png

  • Alert top notification

    alert_top_notification.png

Quick Start

  • Install django-top-notify:

    # bash
    pip install django-top-notify
  • Add django_top_notify into INSTALLED_APPS:

    # settings.py
    INSTALLED_APPS = [
        ...
        "django_top_notify",
        ...
    ]
  • Add urls into urlpatterns:

    # urls.py
    urlpatterns = [
      ...
      path("top_notify/", include("django_top_notify.urls")),
      ...
    ]
  • Collect static files & migrate:

    # bash
    python manage.py collectstatic
    python manage.py migrate django_top_notify
  • Add frontend elements into template:

    <!--templates/index.html-->
    {% load static %}
    <head>
        <link rel="stylesheet" href="{% static 'django_top_notify/css/notification-top-bar.css' %}">
    </head>
    <body>
        <div class="notification-top-bar-container"><div class="notification-top-bar"><p></p></div></div>
        ...
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script src="{% static 'django_top_notify/js/notification-top-bar.js' %}"></script>
        <script>
            $(function () {
                const url = "{% url 'django_top_notify:latest_system_notification' %}";
                get_latest_system_notification(url);
            })
        </script>
    </body>

Donations

If this project helps you, please reward the author with a cup of coffee.(^∀^)

GitHub

View Github