Пример #1
0
 def _process(self):
     rooms_strategy = contains_eager('rooms')
     rooms_strategy.noload('*')
     rooms_strategy.joinedload('location').load_only('room_name_format')
     locations = (Location.query.filter_by(is_deleted=False).join(
         Room, (Location.id == Room.location_id)
         & ~Room.is_deleted).options(rooms_strategy).order_by(
             Location.name, db.func.indico.natsort(Room.full_name)).all())
     return jsonify(locations_schema.dump(locations))
Пример #2
0
 def _process(self):
     rooms_strategy = contains_eager('rooms')
     rooms_strategy.noload('*')
     rooms_strategy.joinedload('location').load_only('room_name_format')
     locations = (Location.query
                  .filter_by(is_deleted=False)
                  .join(Room, (Location.id == Room.location_id) & ~Room.is_deleted)
                  .options(rooms_strategy)
                  .order_by(Location.name, db.func.indico.natsort(Room.full_name))
                  .all())
     return jsonify(locations_schema.dump(locations))