Skip to content

Commit 398ecf5

Browse files
committed
Merge pull request #43 from Chris7/master
option to disable notification
2 parents a75de67 + 710c763 commit 398ecf5

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

django_messages/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django_messages.utils import get_user_model
88
User = get_user_model()
99

10-
if "notification" in settings.INSTALLED_APPS:
10+
if "notification" in settings.INSTALLED_APPS and getattr(settings, 'DJANGO_MESSAGES_NOTIFY', True):
1111
from notification import models as notification
1212
else:
1313
notification = None

django_messages/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from django.utils.translation import ugettext_lazy as _
44
from django.utils import timezone
55

6-
if "notification" in settings.INSTALLED_APPS:
6+
if "notification" in settings.INSTALLED_APPS and getattr(settings, 'DJANGO_MESSAGES_NOTIFY', True):
77
from notification import models as notification
88
else:
99
notification = None

django_messages/management.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from django.conf import settings
33
from django.utils.translation import ugettext_noop as _
44

5-
if "notification" in settings.INSTALLED_APPS:
5+
if "notification" in settings.INSTALLED_APPS and getattr(settings, 'DJANGO_MESSAGES_NOTIFY', True):
66
from notification import models as notification
77

88
def create_notice_types(app, created_models, verbosity, **kwargs):

django_messages/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ def inbox_count_for(user):
100100
return Message.objects.filter(recipient=user, read_at__isnull=True, recipient_deleted_at__isnull=True).count()
101101

102102
# fallback for email notification if django-notification could not be found
103-
if "notification" not in settings.INSTALLED_APPS:
103+
if "notification" not in settings.INSTALLED_APPS and getattr(settings, 'DJANGO_MESSAGES_NOTIFY', True):
104104
from django_messages.utils import new_message_email
105105
signals.post_save.connect(new_message_email, sender=Message)

django_messages/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
User = get_user_model()
1616

17-
if "notification" in settings.INSTALLED_APPS:
17+
if "notification" in settings.INSTALLED_APPS and getattr(settings, 'DJANGO_MESSAGES_NOTIFY', True):
1818
from notification import models as notification
1919
else:
2020
notification = None

0 commit comments

Comments
 (0)