From affa15949911228d0adb55fb325253665f0c127a Mon Sep 17 00:00:00 2001 From: benjaoming Date: Sun, 3 Feb 2013 14:10:46 +0100 Subject: [PATCH] Make django notify admin configurable so it can be excluded --- django_notify/admin.py | 10 ++++++---- django_notify/settings.py | 7 +++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/django_notify/admin.py b/django_notify/admin.py index 957946de..8929a681 100644 --- a/django_notify/admin.py +++ b/django_notify/admin.py @@ -1,8 +1,10 @@ from django.contrib import admin from django_notify import models +from django_notify import settings -admin.site.register(models.NotificationType) -admin.site.register(models.Notification) -admin.site.register(models.Settings) -admin.site.register(models.Subscription) \ No newline at end of file +if settings.ENABLE_ADMIN: + admin.site.register(models.NotificationType) + admin.site.register(models.Notification) + admin.site.register(models.Settings) + admin.site.register(models.Subscription) \ No newline at end of file diff --git a/django_notify/settings.py b/django_notify/settings.py index a2a1c385..28bcb854 100644 --- a/django_notify/settings.py +++ b/django_notify/settings.py @@ -7,6 +7,13 @@ DB_TABLE_PREFIX = 'notify' # You need to switch this setting on, otherwise nothing will happen :) ENABLED = getattr(django_settings, "NOTIFY_ENABLED", True) +# Enable django-admin registration +ENABLE_ADMIN = getattr(django_settings, "NOTIFY_ENABLE_ADMIN", False) + +################################## +# PLANNED CONFIGURATION SETTINGS # +################################## + # Email notifications are just optional... if you don't have access # to a proper SMTP server, just leave it off... SEND_EMAILS = getattr(django_settings, "NOTIFY_SEND_EMAILS", False) -- 2.45.2