# Path: dwitter/main/tasks.py
# @task
# def celery_send_mail(subject, message, from_email, to_email):
#     send_mail(subject, message, from_email, [to_email])


import urllib
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils.crypto import get_random_string
from django.utils.encoding import smart_str
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.contrib import auth
from auth.hashers import (
    check_password, make_password, is_password_usable, UNUSABLE_PASSWORD)
from auth.signals import user_logged_in
from django.contrib.contenttypes.models import ContentType
from dwitter.main.tasks import celery_send_mail
            from django.conf import settings

        # Otherwise we need to check the backends.
        return _user_has_perm(self, perm, obj)

    def has_perms(self, perm_list, obj=None):
        """
        Returns True if the user has each of the specified permissions. If
        object is passed, it checks if the user has all required perms for this
        object.
        """
        for perm in perm_list:
            if not self.has_perm(perm, obj):
                return False
        return True

    def has_module_perms(self, app_label):
        """
        Returns True if the user has any permissions in the given app label.
        Uses pretty much the same logic as has_perm, above.
        """
        # Active superusers have all permissions.
        if self.is_active and self.is_superuser:
            return True

        return _user_has_module_perms(self, app_label)

    def email_user(self, subject, message, from_email=None):
        """
        Sends an email to this User.
        """

# Path: dwitter/main/tasks.py
# @task
# def celery_send_mail(subject, message, from_email, to_email):
#     send_mail(subject, message, from_email, [to_email])


# Path: auth/models.py
import urllib
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils.crypto import get_random_string
from django.utils.encoding import smart_str
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.contrib import auth
from auth.hashers import (
    check_password, make_password, is_password_usable, UNUSABLE_PASSWORD)
from auth.signals import user_logged_in
from django.contrib.contenttypes.models import ContentType
from dwitter.main.tasks import celery_send_mail
            from django.conf import settings


        # Otherwise we need to check the backends.
        return _user_has_perm(self, perm, obj)

    def has_perms(self, perm_list, obj=None):
        """
        Returns True if the user has each of the specified permissions. If
        object is passed, it checks if the user has all required perms for this
        object.
        """
        for perm in perm_list:
            if not self.has_perm(perm, obj):
                return False
        return True

    def has_module_perms(self, app_label):
        """
        Returns True if the user has any permissions in the given app label.
        Uses pretty much the same logic as has_perm, above.
        """
        # Active superusers have all permissions.
        if self.is_active and self.is_superuser:
            return True

        return _user_has_module_perms(self, app_label)

    def email_user(self, subject, message, from_email=None):
        """
        Sends an email to this User.
        """

        celery_send_mail.delay(subject, message, from_email, [self.email])