# Path: yak/rest_notifications/models.py
# class NotificationSetting(CoreModel):
#     notification_type = models.ForeignKey(NotificationType, related_name="user_settings", on_delete=models.CASCADE)
#     user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='notification_settings', on_delete=models.CASCADE)
#     allow_push = models.BooleanField(default=True)
#     allow_email = models.BooleanField(default=True)
# 
#     class Meta:
#         unique_together = ('notification_type', 'user')
#         ordering = ['-created']
# 
#     def __unicode__(self):
#         return "{}: {}".format(self.user, self.notification_type)
# 
#     def name(self):
#         return "{}: {}".format(self.user, self.notification_type)
# 
# class NotificationType(CachingMixin, CoreModel):
#     name = models.CharField(max_length=32)
#     slug = models.SlugField(unique=True)
#     description = models.CharField(max_length=255)
#     is_active = models.BooleanField(default=True)
# 
#     objects = CachingManager()
# 
#     def __unicode__(self):
#         return "{}".format(self.name)


from django.contrib.auth import get_user_model
from django.core.management import BaseCommand
from yak.rest_notifications.models import NotificationSetting, NotificationType

__author__ = 'rudolphmutter'


User = get_user_model()


class Command(BaseCommand):
    args = ''

# Path: yak/rest_notifications/models.py
# class NotificationSetting(CoreModel):
#     notification_type = models.ForeignKey(NotificationType, related_name="user_settings", on_delete=models.CASCADE)
#     user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='notification_settings', on_delete=models.CASCADE)
#     allow_push = models.BooleanField(default=True)
#     allow_email = models.BooleanField(default=True)
# 
#     class Meta:
#         unique_together = ('notification_type', 'user')
#         ordering = ['-created']
# 
#     def __unicode__(self):
#         return "{}: {}".format(self.user, self.notification_type)
# 
#     def name(self):
#         return "{}: {}".format(self.user, self.notification_type)
# 
# class NotificationType(CachingMixin, CoreModel):
#     name = models.CharField(max_length=32)
#     slug = models.SlugField(unique=True)
#     description = models.CharField(max_length=255)
#     is_active = models.BooleanField(default=True)
# 
#     objects = CachingManager()
# 
#     def __unicode__(self):
#         return "{}".format(self.name)


# Path: yak/rest_notifications/management/commands/add_missing_notification_settings.py
from django.contrib.auth import get_user_model
from django.core.management import BaseCommand
from yak.rest_notifications.models import NotificationSetting, NotificationType


__author__ = 'rudolphmutter'


User = get_user_model()


class Command(BaseCommand):
    args = ''

    help = 'Creates missing notification settings for existing users'