def db_subscription(*args, **kwargs):
    from dbmail import import_by_string
    from dbmail.defaults import MAIL_SUBSCRIPTION_MODEL

    MailSubscription = import_by_string(MAIL_SUBSCRIPTION_MODEL)

    MailSubscription.notify(*args, **kwargs)
Beispiel #2
0
def db_subscription(*args, **kwargs):
    from dbmail import import_by_string
    from dbmail.defaults import MAIL_SUBSCRIPTION_MODEL

    MailSubscription = import_by_string(MAIL_SUBSCRIPTION_MODEL)

    MailSubscription.notify(*args, **kwargs)
Beispiel #3
0
from django.core.cache import cache
from django.utils import timezone
from django.conf import settings
from django.db import models
from django import VERSION

from dbmail.defaults import (PRIORITY_STEPS, UPLOAD_TO, DEFAULT_CATEGORY,
                             AUTH_USER_MODEL, DEFAULT_FROM_EMAIL,
                             DEFAULT_PRIORITY, CACHE_TTL, BACKEND, _BACKEND,
                             MODEL_HTMLFIELD)

from dbmail import initial_signals, import_by_string
from dbmail import python_2_unicode_compatible
from dbmail.utils import premailer_transform

HTMLField = import_by_string(MODEL_HTMLFIELD)

BACKENDS = (
    ('dbmail.backends.mail', _('MailBox')),
    ('dbmail.backends.push', _('Push')),
    ('dbmail.backends.sms', _('SMS')),
    ('dbmail.backends.tts', _('TTS')),
)


def _upload_mail_file(instance, filename):
    if instance is not None:
        ext = filename.split('.')[-1]
        filename = "%s.%s" % (str(uuid.uuid4()), ext)
        return os.path.join(UPLOAD_TO, filename)
Beispiel #4
0
from django.db import models
from django import VERSION

from dbmail.defaults import (
    PRIORITY_STEPS, UPLOAD_TO, DEFAULT_CATEGORY, AUTH_USER_MODEL,
    DEFAULT_FROM_EMAIL, DEFAULT_PRIORITY, CACHE_TTL,
    BACKEND, _BACKEND, BACKENDS_MODEL_CHOICES, MODEL_HTMLFIELD,
    MODEL_SUBSCRIPTION_DATA_FIELD
)

from dbmail import initial_signals, import_by_string
from dbmail import python_2_unicode_compatible
from dbmail.utils import premailer_transform


HTMLField = import_by_string(MODEL_HTMLFIELD)
SubscriptionDataField = import_by_string(MODEL_SUBSCRIPTION_DATA_FIELD)


def _upload_mail_file(instance, filename):
    if instance is not None:
        ext = filename.split('.')[-1]
        filename = "%s.%s" % (str(uuid.uuid4()), ext)
        return os.path.join(UPLOAD_TO, filename)


@python_2_unicode_compatible
class MailCategory(models.Model):
    name = models.CharField(_('Category'), max_length=25, unique=True)
    created = models.DateTimeField(_('Created'), auto_now_add=True)
    updated = models.DateTimeField(_('Updated'), auto_now=True)
Beispiel #5
0
from dbmail.defaults import (
    PRIORITY_STEPS, UPLOAD_TO, DEFAULT_CATEGORY, AUTH_USER_MODEL,
    DEFAULT_FROM_EMAIL, DEFAULT_PRIORITY, CACHE_TTL,
    BACKEND, _BACKEND, BACKENDS_MODEL_CHOICES, MODEL_HTMLFIELD,
    MODEL_SUBSCRIPTION_DATA_FIELD, SORTED_BACKEND_CHOICES, TRACK_USE_GEOIP2,
    INCLUDE_LOG_CONTEXT_FIELDS
)

from dbmail import initial_signals, import_by_string
from dbmail import python_2_unicode_compatible
from dbmail.utils import premailer_transform, get_ip, dotval
from dbmail.querysets import MailCredentialQuerySet


HTMLField = import_by_string(MODEL_HTMLFIELD)
SubscriptionDataField = import_by_string(MODEL_SUBSCRIPTION_DATA_FIELD)


def _upload_mail_file(instance, filename):
    if instance is not None:
        ext = filename.split('.')[-1]
        filename = "%s.%s" % (str(uuid.uuid4()), ext)
        return os.path.join(UPLOAD_TO, filename)


@python_2_unicode_compatible
class MailCategory(models.Model):
    name = models.CharField(_('Category'), max_length=25, unique=True)
    created = models.DateTimeField(_('Created'), auto_now_add=True)
    updated = models.DateTimeField(_('Updated'), auto_now=True)
Beispiel #6
0
from django.utils import timezone
from django.conf import settings
from django.db import models
from django import VERSION

from dbmail.defaults import (
    PRIORITY_STEPS, UPLOAD_TO, DEFAULT_CATEGORY, AUTH_USER_MODEL,
    DEFAULT_FROM_EMAIL, DEFAULT_PRIORITY, CACHE_TTL,
    BACKEND, _BACKEND, BACKENDS_MODEL_CHOICES, MODEL_HTMLFIELD)

from dbmail import initial_signals, import_by_string
from dbmail import python_2_unicode_compatible
from dbmail.utils import premailer_transform


HTMLField = import_by_string(MODEL_HTMLFIELD)


def _upload_mail_file(instance, filename):
    if instance is not None:
        ext = filename.split('.')[-1]
        filename = "%s.%s" % (str(uuid.uuid4()), ext)
        return os.path.join(UPLOAD_TO, filename)


@python_2_unicode_compatible
class MailCategory(models.Model):
    name = models.CharField(_('Category'), max_length=25, unique=True)
    created = models.DateTimeField(_('Created'), auto_now_add=True)
    updated = models.DateTimeField(_('Updated'), auto_now=True)