コード例 #1
0
def get_active_call_to_action():
    """Return the active call to action."""
    now = arrow.utcnow().to(current_app.config['TIME_ZONE']).naive

    return CallToAction.query.current.filter(
        CallToAction.active == True,  # NOQA
        CallToAction.begins < now,
        db.or_(CallToAction.ends > now, CallToAction.ends == None),
    ).order_by(CallToAction.begins, db.desc(CallToAction.ends)).first()
コード例 #2
0
ファイル: __init__.py プロジェクト: jmeekr/pygotham
def get_active_call_to_action():
    """Return the active call to action."""
    now = arrow.utcnow().to('America/New_York').naive

    return CallToAction.query.current.filter(
        CallToAction.active == True,  # NOQA
        CallToAction.begins < now,
        db.or_(CallToAction.ends > now, CallToAction.ends == None),
    ).order_by(CallToAction.begins, db.desc(CallToAction.ends)).first()
コード例 #3
0
def get_active_announcements():
    """Get the active announcements."""
    now = arrow.utcnow().to(current_app.config['TIME_ZONE']).naive

    # TODO: Possibly display old announcements if the current event has none.
    return Announcement.query.current.filter(
        Announcement.active == True,  # NOQA
        Announcement.published < now,
    ).order_by(db.desc(Announcement.published)).all()
コード例 #4
0
def get_active_announcements():
    """Get the active announcements."""
    now = arrow.utcnow().to('America/New_York').naive

    # TODO: Possibly display old announcements if the current event has none.
    return Announcement.query.current.filter(
        Announcement.active == True,
        Announcement.published < now,
    ).order_by(db.desc(Announcement.published)).all()