# Path: web/processors/user.py
# def get_ambassadors_for_country(country):
#     ambassadors = User.objects.filter(
#         groups__name='ambassadors',
#         userprofile__country=country)
#     return ambassadors


from django.core.mail import send_mail
from django.template import loader, Context
from django.conf import settings
from web.processors.user import get_ambassadors_for_country
#!/usr/bin/python
# -*- coding: utf-8 -*-


'''
Generates and sends event report to ambassadors users
'''


def send_event_report_email(user, event):
    template = loader.get_template("mailer/event_email.txt")
    context = Context({'user': user, 'event': event})

    txt_content = template.render(context)

    send_mail('A new event on codeweek.eu needs your attention',
              txt_content, "info@codeweek.eu", [user.email])


def send_email_to_country_ambassadors(event):

# Path: web/processors/user.py
# def get_ambassadors_for_country(country):
#     ambassadors = User.objects.filter(
#         groups__name='ambassadors',
#         userprofile__country=country)
#     return ambassadors


# Path: mailer/event_report_mailer.py
from django.core.mail import send_mail
from django.template import loader, Context
from django.conf import settings
from web.processors.user import get_ambassadors_for_country

#!/usr/bin/python
# -*- coding: utf-8 -*-


'''
Generates and sends event report to ambassadors users
'''


def send_event_report_email(user, event):
    template = loader.get_template("mailer/event_email.txt")
    context = Context({'user': user, 'event': event})

    txt_content = template.render(context)

    send_mail('A new event on codeweek.eu needs your attention',
              txt_content, "info@codeweek.eu", [user.email])


def send_email_to_country_ambassadors(event):

    ambassadors = get_ambassadors_for_country(event.country)