# Path: yak/rest_core/models.py
# class CoreModel(models.Model):
#     created = models.DateTimeField(auto_now_add=True, null=True)
# 
#     def __repr__(self):
#         return '<{}:{} {}>'.format(self.__class__.__name__, self.pk, str(self))
# 
#     class Meta:
#         abstract = True
# 
# Path: yak/settings.py
# def perform_import(val, setting_name):
#     def __getattr__(self, attr):
# class YAKAPISettings(APISettings):
# USER_SETTINGS = getattr(settings, 'YAK', None)
# DEFAULTS = {
#     'USER_APP_LABEL': 'test_app',
#     'USER_MODEL': 'user',
#     'USER_SERIALIZER': "test_app.api.serializers.UserSerializer",
#     'API_SCHEMA': 'api-schema-1.0.json',
#     'SOCIAL_MODEL': "test_app.models.Post",
#     'ALLOW_EMAIL': True,
#     'ALLOW_PUSH': True,
#     'EMAIL_NOTIFICATION_SUBJECT': 'Test Project Notification',
#     'PUSHWOOSH_AUTH_TOKEN': "",
#     'PUSHWOOSH_APP_CODE': "",
#     'PUSH_NOTIFICATION_HANDLER': "yak.rest_notifications.utils.send_pushwoosh_notification",
#     'SOCIAL_SHARE_DELAY': 60,
#     'USE_FACEBOOK_OG': False,
#     'FACEBOOK_OG_NAMESPACE': "",
#     'SERIALIZER_MAPPING': {},
#     'FLAKE8_CONFIG': None,
# }
# IMPORT_STRINGS = (
#     "USER_SERIALIZER",
#     "SOCIAL_MODEL",
#     "SERIALIZER_MAPPING",
# )


from collections import defaultdict
from caching.base import CachingMixin, CachingManager
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.db import models
from django.template.loader import render_to_string
from celery.task import task
from yak.rest_core.models import CoreModel
from yak.settings import yak_settings
        from .utils import send_push_notification
        from .utils import send_email_notification


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_core/models.py
# class CoreModel(models.Model):
#     created = models.DateTimeField(auto_now_add=True, null=True)
# 
#     def __repr__(self):
#         return '<{}:{} {}>'.format(self.__class__.__name__, self.pk, str(self))
# 
#     class Meta:
#         abstract = True
# 
# Path: yak/settings.py
# def perform_import(val, setting_name):
#     def __getattr__(self, attr):
# class YAKAPISettings(APISettings):
# USER_SETTINGS = getattr(settings, 'YAK', None)
# DEFAULTS = {
#     'USER_APP_LABEL': 'test_app',
#     'USER_MODEL': 'user',
#     'USER_SERIALIZER': "test_app.api.serializers.UserSerializer",
#     'API_SCHEMA': 'api-schema-1.0.json',
#     'SOCIAL_MODEL': "test_app.models.Post",
#     'ALLOW_EMAIL': True,
#     'ALLOW_PUSH': True,
#     'EMAIL_NOTIFICATION_SUBJECT': 'Test Project Notification',
#     'PUSHWOOSH_AUTH_TOKEN': "",
#     'PUSHWOOSH_APP_CODE': "",
#     'PUSH_NOTIFICATION_HANDLER': "yak.rest_notifications.utils.send_pushwoosh_notification",
#     'SOCIAL_SHARE_DELAY': 60,
#     'USE_FACEBOOK_OG': False,
#     'FACEBOOK_OG_NAMESPACE': "",
#     'SERIALIZER_MAPPING': {},
#     'FLAKE8_CONFIG': None,
# }
# IMPORT_STRINGS = (
#     "USER_SERIALIZER",
#     "SOCIAL_MODEL",
#     "SERIALIZER_MAPPING",
# )


# Path: yak/rest_notifications/models.py
from collections import defaultdict
from caching.base import CachingMixin, CachingManager
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.db import models
from django.template.loader import render_to_string
from celery.task import task
from yak.rest_core.models import CoreModel
from yak.settings import yak_settings
        from .utils import send_push_notification
        from .utils import send_email_notification



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)



class NotificationSetting(CoreModel):