Exemplo n.º 1
0
from django.contrib.contenttypes import generic
from django.dispatch import receiver
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext as _
from django.utils import translation
from bluebottle.utils.model_dispatcher import get_user_model
from bluebottle.bb_projects.models import BaseProject
from bluebottle.bb_tasks.models import BaseTask, BaseTaskMember
from bluebottle.bb_donations.models import BaseDonation
from bluebottle.bb_fundraisers.models import BaseFundraiser
from bluebottle.clients.utils import tenant_url
from bluebottle.utils.email_backend import send_mail
from bluebottle.clients import properties


USER_MODEL = get_user_model()


class Follow(models.Model):

    """
    Generic Follow class. A Follow object is a generic reference between a
    user and another Django model.
    """

    user = models.ForeignKey(USER_MODEL)
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    followed_object = generic.GenericForeignKey('content_type', 'object_id')

    def __unicode__(self):
Exemplo n.º 2
0
def send_welcome_mail_callback(sender, instance, created, **kwargs):
    from django.contrib.auth import get_user_model
    USER_MODEL = get_user_model()
    if getattr(settings, "SEND_WELCOME_MAIL") and isinstance(instance, USER_MODEL) and created:
        if valid_email(instance.email):
            send_welcome_mail(user=instance)