Пример #1
0
 def portalboxes_ln(self):
     """Get Portalboxes ln."""
     return db.object_session(self).query(CollectionPortalbox).\
         with_parent(self).\
         options(db.joinedload_all(CollectionPortalbox.portalbox)).\
         filter(CollectionPortalbox.ln == g.ln).\
         order_by(db.desc(CollectionPortalbox.score)).all()
Пример #2
0
 def portalboxes_ln(self):
     """Get Portalboxes ln."""
     return db.object_session(self).query(CollectionPortalbox).\
         with_parent(self).\
         options(db.joinedload_all(CollectionPortalbox.portalbox)).\
         filter(CollectionPortalbox.ln == g.ln).\
         order_by(db.desc(CollectionPortalbox.score)).all()
Пример #3
0
    def get_current(cls, start_date=None):
        """Get the latest featured community."""
        start_date = start_date or datetime.now()

        return cls.query.options(
            db.joinedload_all('community.collection')).filter(
                cls.start_date <= start_date).order_by(
                    cls.start_date.desc()).first()
Пример #4
0
    def get_current(cls, start_date=None):
        """Get the latest featured community."""
        start_date = start_date or datetime.now()

        return cls.query.options(db.joinedload_all(
            'community.collection')).filter(
            cls.start_date <= start_date).order_by(
            cls.start_date.desc()).first()
Пример #5
0
def get_message(uid, msgid):
    """
    Get a message with its status and sender nickname.
    @param uid: user id
    @param msgid: message id
    @return: exactly one message or raise an exception.
    """
    return  UserMsgMESSAGE.query.options(\
            db.joinedload_all(UserMsgMESSAGE.message, MsgMESSAGE.user_from)).\
            options(db.joinedload(UserMsgMESSAGE.user_to)).\
            filter(filter_user_message(uid, msgid)).one()
Пример #6
0
def get_message(uid, msgid):
    """
    Get a message with its status and sender nickname.
    @param uid: user id
    @param msgid: message id
    @return: exactly one message or raise an exception.
    """
    return  UserMsgMESSAGE.query.options(\
            db.joinedload_all(UserMsgMESSAGE.message, MsgMESSAGE.user_from)).\
            options(db.joinedload(UserMsgMESSAGE.user_to)).\
            filter(filter_user_message(uid, msgid)).one()