first commit

This commit is contained in:
2026-01-16 22:20:18 +03:00
commit 5d437e5e28
56 changed files with 4463 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
from django.core.management.base import BaseCommand
from monitor.models import NotificationPreference
class Command(BaseCommand):
help = 'Setup initial notification preferences'
def add_arguments(self, parser):
parser.add_argument(
'--emails',
nargs='+',
type=str,
default=['ali.c.zeybek@gmail.com', 'alican@alicanzeybek.xyz'],
help='Email addresses to setup notifications for'
)
def handle(self, *args, **options):
emails = options['emails']
for email in emails:
# Check if preference already exists
pref, created = NotificationPreference.objects.get_or_create(
email_address=email,
defaults={
'receive_event_alerts': True,
'receive_system_alerts': True,
'receive_daily_digest': True,
'is_active': True,
}
)
if created:
self.stdout.write(
self.style.SUCCESS(f'Created notification preference for {email}')
)
else:
self.stdout.write(
self.style.WARNING(f'Notification preference for {email} already exists')
)
self.stdout.write(
self.style.SUCCESS(f'Setup complete for {len(emails)} email(s)')
)