# django-messages-display
Display messages from django.contrib.messages as notifications in the browser.
## Setup
Install the package using `pip`:
```shell
python -m pip install django-messages-display
```
Add it to the installed apps of your project:
```python
INSTALLED_APPS = [
...
"django_messages_display",
...
]
```
## How to use
1. Load the template tag in your template:
```
{% load django_messages_display %}
```
2. Use the `django_messages_display` tag where you want the notifications to appear:
```
{% django_messages_display %}
```
A good place to add this is before the closing body tag `</body>`.
3. Load the CSS for the styling to apply:
```
{% load static %}
...
<head>
...
<link rel="stylesheet" href="{% static 'django_messages_display/django_messages_display.css' %}">
</head>
```
### Example
It is convenient to integrate django-messages-display in your base template:
```html
<!-- base.html -->
{% load static %}
{% load django_messages_display %}
...
<head>
...
<link rel="stylesheet" href="{% static 'django_messages_display/django_messages_display.css' %}">
</head>
...
{% django_messages_display %}
</body>
...
```
## Configuration
To include a close button for each message, add the following to your Django settings:
```python
DJANGO_MESSAGES_DISPLAY_CLOSE_BUTTON = True
```
## Accessibility
The notifications have the relevant attributes so that screen readers announce each one without interrupting the user's flow.
Even though the notifications visually disappear after a certain amount of time, they remain in the document to be accessible by screen readers on demand.
The colors used for the notifications meet the WCAG 2.1 AA contrast levels.
Raw data
{
"_id": null,
"home_page": "https://github.com/demestav/django-messages-display",
"name": "django-messages-display",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Demetris Stavrou",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/4a/96/ee36768083595782990354c12d3c0625cfcd965c62461322dce7bf0cca02/django_messages_display-0.5.0.tar.gz",
"platform": null,
"description": "# django-messages-display\nDisplay messages from django.contrib.messages as notifications in the browser.\n\n## Setup\nInstall the package using `pip`:\n\n```shell\npython -m pip install django-messages-display\n```\n\nAdd it to the installed apps of your project:\n```python\nINSTALLED_APPS = [\n ...\n \"django_messages_display\",\n ...\n]\n```\n\n## How to use\n1. Load the template tag in your template:\n ```\n {% load django_messages_display %}\n ```\n\n2. Use the `django_messages_display` tag where you want the notifications to appear:\n ```\n {% django_messages_display %}\n ```\n A good place to add this is before the closing body tag `</body>`.\n\n3. Load the CSS for the styling to apply:\n ```\n {% load static %}\n ...\n <head>\n ...\n <link rel=\"stylesheet\" href=\"{% static 'django_messages_display/django_messages_display.css' %}\">\n </head>\n ```\n\n### Example\nIt is convenient to integrate django-messages-display in your base template:\n\n```html\n<!-- base.html -->\n{% load static %}\n{% load django_messages_display %}\n...\n<head>\n ...\n <link rel=\"stylesheet\" href=\"{% static 'django_messages_display/django_messages_display.css' %}\">\n</head>\n...\n{% django_messages_display %}\n</body>\n...\n```\n\n## Configuration\nTo include a close button for each message, add the following to your Django settings:\n\n```python\nDJANGO_MESSAGES_DISPLAY_CLOSE_BUTTON = True\n```\n\n## Accessibility\nThe notifications have the relevant attributes so that screen readers announce each one without interrupting the user's flow.\nEven though the notifications visually disappear after a certain amount of time, they remain in the document to be accessible by screen readers on demand.\n\nThe colors used for the notifications meet the WCAG 2.1 AA contrast levels.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Display messages from django.contrib.messages as notifications in the browser.",
"version": "0.5.0",
"project_urls": {
"Homepage": "https://github.com/demestav/django-messages-display"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7f61430788f864d4efa287aea9f11ba8e506ed48d4f1265c8c9fdaf7642b0097",
"md5": "d8aeb6967a2bffa50f78d673d8988d88",
"sha256": "b4198e62da5ce2c7f6aa09f5acf7d1fe656046f1bf0ef5a612c212a717bf81d3"
},
"downloads": -1,
"filename": "django_messages_display-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d8aeb6967a2bffa50f78d673d8988d88",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5669,
"upload_time": "2024-09-02T21:06:17",
"upload_time_iso_8601": "2024-09-02T21:06:17.782000Z",
"url": "https://files.pythonhosted.org/packages/7f/61/430788f864d4efa287aea9f11ba8e506ed48d4f1265c8c9fdaf7642b0097/django_messages_display-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4a96ee36768083595782990354c12d3c0625cfcd965c62461322dce7bf0cca02",
"md5": "358ee3ba971c1ef99f64816ae0d76b3f",
"sha256": "7021d7eeabe608f37996a04f51886de976e2c136268e3a2ed6aaf351b8858385"
},
"downloads": -1,
"filename": "django_messages_display-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "358ee3ba971c1ef99f64816ae0d76b3f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5591,
"upload_time": "2024-09-02T21:06:19",
"upload_time_iso_8601": "2024-09-02T21:06:19.053312Z",
"url": "https://files.pythonhosted.org/packages/4a/96/ee36768083595782990354c12d3c0625cfcd965c62461322dce7bf0cca02/django_messages_display-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-02 21:06:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "demestav",
"github_project": "django-messages-display",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "django-messages-display"
}