django-top-notify-1.0.0
توضیحات
A top notification bar based on Django project
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | django-top-notify-1.0.0 |
| نام | django-top-notify |
| نسخه کتابخانه | 1.0.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | waylon |
| ایمیل نویسنده | 1158341873@qq.com |
| آدرس صفحه اصلی | https://github.com/normal-wls/django-top-notify |
| آدرس اینترنتی | https://pypi.org/project/django-top-notify/ |
| مجوز | - |
# django-top-notify
[](https://github.com/normal-wls/django-top-notify/blob/main/LICENSE) [](https://github.com/normal-wls/django-top-notify/releases)
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:

- Hint top notification

- Alert top notification

### Quick Start
- Install django-top-notify:
```shell
# bash
pip install django-top-notify
```
- Add `django_top_notify` into INSTALLED_APPS:
``` python
# settings.py
INSTALLED_APPS = [
...
"django_top_notify",
...
]
```
- Add urls into urlpatterns:
``` python
# urls.py
urlpatterns = [
...
path("top_notify/", include("django_top_notify.urls")),
...
]
```
- Collect static files & migrate:
```shell
# bash
python manage.py collectstatic
python manage.py migrate django_top_notify
```
- Add frontend elements into template:
``` html
<!--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>
```
نحوه نصب
نصب پکیج whl django-top-notify-1.0.0:
pip install django-top-notify-1.0.0.whl
نصب پکیج tar.gz django-top-notify-1.0.0:
pip install django-top-notify-1.0.0.tar.gz