===================================
Demo admin https://djnotty.herokuapp.com/admin Cred: guest password
===================================================================
Installation
============
Put ``djnotty`` to ``settings.py`` Put
``url(r'^djnotty/', include('djnotty.urls', namespace='djnotty')),``
to ``urls.py``
Override default ``admin/base_site.html`` or copy this code to custom
admin template {% load static %} {% block extrahead %}
.. raw:: html
<script>
var djnotty_url = '{% url 'djnotty:messages' %}'
</script>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="{% static 'djnotty/js/packaged/jquery.noty.packaged.min.js' %}"></script>
<script src="{% static 'djnotty/js/notty.js' %}"></script>
{{ block.super }} {% endblock %}
If you want use djnotty on non admin pages:
::
<script>
var djnotty_url = '{% url 'djnotty:messages' %}';
var csrf_token = '{{ csrf_token }}'; // for unauthorized users
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="{% static 'djnotty/js/packaged/jquery.noty.packaged.min.js' %}"></script>
<script src="{% static 'djnotty/js/notty.js' %}"></script>
How to create messages
======================
Create notification for user
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
from djnotty import noty_builder
from djnotty.models import Message
from django.contrib.auth.models import Group
Message.objects.create_for_object(%TARGET_OBJECT%, users=[%USER_OBJECT%], builders=[noty_builder.Text('Specific for user'),noty_builder.Close()])
Create notification for group and user
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
from djnotty import noty_builder
from djnotty.models import Message
Message.objects.create_for_object(%TARGET_OBJECT%, groups=[Group.objects.get(name='superadmin')],users=[%USER_OBJECT%], builders=[noty_builder.Text('Specific for user and group'),noty_builder.Close()])
Create globally message:
~~~~~~~~~~~~~~~~~~~~~~~~
::
from djnotty import noty_builder
from djnotty.models import Message
Message.objects.create_globally(builders=[noty_builder.Text('Specific for user and group'),noty_builder.Close()])
Mark as read
============
::
from djnotty.models import Message
Message.objects.create_globally(builders=[noty_builder.Text('Specific for user and group'),noty_builder.Close()])
Message.objects.mark_as_viewed_for_object(%TARGET_OBJECT%,%USER_MODEL%)
noty\_builder
~~~~~~~~~~~~~
Text:
~~~~~
::
Put text to popup window
Close:
~~~~~~
::
Notification mark as read for user after click.
Close(url='redect me after click')
Linked:
~~~~~~~
::
Redirect to url after click on notification
What is %TARGET\_OBJECT%
~~~~~~~~~~~~~~~~~~~~~~~~
Djnotty using django\_content\_types framework for identify records.
Metadata
Release files for djnotty 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| djnotty-0.0.5.tar.gz | 28.2 kB | Without provenance | Details for djnotty-0.0.5.tar.gz |
Release files / djnotty-0.0.5.tar.gz
| Download URL | djnotty-0.0.5.tar.gz |
|---|---|
| Size | 28.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c304673cd420611f9bea6061761c384e3c08971c187b63451920be02b4e2a818
|
|
BLAKE2b-256 checksum How to use checksums |
e10e76c0c49e102fa3935d4559200ca6846a3c42d632e452fc62494968f8ae21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for djnotty 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.