当前位置: 首页>>代码示例>>Python>>正文


Python Event.featured_events_for_region方法代码示例

本文整理汇总了Python中event.models.Event.featured_events_for_region方法的典型用法代码示例。如果您正苦于以下问题:Python Event.featured_events_for_region方法的具体用法?Python Event.featured_events_for_region怎么用?Python Event.featured_events_for_region使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在event.models.Event的用法示例。


在下文中一共展示了Event.featured_events_for_region方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: remind_account_about_events_with_email

# 需要导入模块: from event.models import Event [as 别名]
# 或者: from event.models.Event import featured_events_for_region [as 别名]
def remind_account_about_events_with_email(account, single_events):
    featured_events = Event.featured_events_for_region(account.native_region)

    similar_events = find_similar_events(
        Event.future_events.filter(id__in=single_events.values_list("event_id", flat=True))
    )

    subject = "Upcoming events from cityfusion"

    message = render_to_string(
        "accounts/emails/reminder_email.html",
        {
            "featured_events": featured_events,
            "events": single_events,
            "similar_events": similar_events,
            "STATIC_URL": "/static/",
            "advertising_region": account.advertising_region,
            "site": "http://%s" % Site.objects.get_current().domain,
        },
    )

    msg = EmailMessage(subject, message, "[email protected]", [account.reminder_email])
    msg.content_subtype = "html"
    msg.send()

    return message
开发者ID:kahihia,项目名称:cityfusion,代码行数:28,代码来源:utils.py

示例2: inform_account_about_events_with_tag_with_email

# 需要导入模块: from event.models import Event [as 别名]
# 或者: from event.models.Event import featured_events_for_region [as 别名]
def inform_account_about_events_with_tag_with_email(account, events, tags_in_venues):
    featured_events = Event.featured_events_for_region(account.native_region)[:4]

    similar_events = find_similar_events(events)

    subject = "New Events in cityfusion"

    message = render_to_string(
        "accounts/emails/in_the_loop_email.html",
        {
            "featured_events": featured_events,
            "events": events,
            "similar_events": similar_events,
            "STATIC_URL": "/static/",
            "site": "http://%s" % Site.objects.get_current().domain,
            "tags_in_venues": tags_in_venues,
            "advertising_region": account.advertising_region,
        },
    )

    msg = EmailMessage(subject, message, "[email protected]", [account.in_the_loop_email])

    msg.content_subtype = "html"

    msg.send()

    return message
开发者ID:kahihia,项目名称:cityfusion,代码行数:29,代码来源:utils.py

示例3: remind_account_about_events_with_email

# 需要导入模块: from event.models import Event [as 别名]
# 或者: from event.models.Event import featured_events_for_region [as 别名]
def remind_account_about_events_with_email(account, single_events):
    if account.reminder_email:
        featured_events = Event.featured_events_for_region(account.native_region)[0:4]

        similar_events = find_similar_events(
            Event.future_events.filter(id__in=single_events.values_list("event_id", flat=True))
        )

        subject = "Upcoming events from cityfusion"

        message = render_to_string('accounts/emails/reminder_email.html', {
                "featured_events": featured_events,
                "events": single_events,
                "similar_events": similar_events,
                "STATIC_URL": "/static/",
                "advertising_region": account.advertising_region,
                "site": "http://%s" % Site.objects.get_current().domain
            })

        try:
            msg = EmailMessage(subject,
                       message,
                       "[email protected]",
                       [account.reminder_email])
            msg.content_subtype = 'html'
            msg.send()
        except:
            logger.error("Invalid email %s" % account.reminder_email)

        return message

    else:
        return ""
开发者ID:dany431,项目名称:cityfusion,代码行数:35,代码来源:utils.py

示例4: remind_account_about_deleted_events_with_email

# 需要导入模块: from event.models import Event [as 别名]
# 或者: from event.models.Event import featured_events_for_region [as 别名]
def remind_account_about_deleted_events_with_email(account, single_events):
    if account.reminder_email:
        featured_events = Event.featured_events_for_region(account.native_region)[:4]
        subject = 'Deleted events from cityfusion'

        message = render_to_string('accounts/emails/reminder_deleted_event_email.html', {
                "featured_events": featured_events,
                "events": single_events,
                "STATIC_URL": "/static/",
                "advertising_region": account.advertising_region,
                "site": "http://%s" % Site.objects.get_current().domain
            })

        try:
            msg = EmailMessage(subject,
                       message,
                       "[email protected]",
                       [account.reminder_email])
            msg.content_subtype = 'html'
            msg.send()
        except:
            logger.error("Invalid email %s" % account.reminder_email)

        return message

    else:
        return ""
开发者ID:dany431,项目名称:cityfusion,代码行数:29,代码来源:utils.py

示例5: remind_account_about_deleted_events_with_email

# 需要导入模块: from event.models import Event [as 别名]
# 或者: from event.models.Event import featured_events_for_region [as 别名]
def remind_account_about_deleted_events_with_email(account, single_events):
    featured_events = Event.featured_events_for_region(account.native_region)
    subject = "Deleted events from cityfusion"

    message = render_to_string(
        "accounts/emails/reminder_deleted_event_email.html",
        {
            "featured_events": featured_events,
            "events": single_events,
            "STATIC_URL": "/static/",
            "advertising_region": account.advertising_region,
            "site": "http://%s" % Site.objects.get_current().domain,
        },
    )
    print message
    msg = EmailMessage(subject, message, "[email protected]", [account.reminder_email])
    msg.content_subtype = "html"
    msg.send()

    return message
开发者ID:kahihia,项目名称:cityfusion,代码行数:22,代码来源:utils.py


注:本文中的event.models.Event.featured_events_for_region方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。