示例#1
0
def walls() -> str:
    sector = request.args.get("sector")
    level = request.args.get("level")
    localization = request.args.get("localization")
    brick_type = request.args.get("brick_type")
    wall_width = request.args.get("wall_width")
    items = Wall.get_all_items(g.current_invest.id)
    if sector:
        items = items.filter_by(sector=sector)
    if level:
        items = items.filter_by(level=level)
    if localization:
        items = items.filter_by(localization=localization)
    if brick_type:
        items = items.filter_by(brick_type=brick_type)
    if wall_width:
        items = items.filter_by(wall_width=wall_width)
    items = items.order_by("local_id").all()
    total = TotalAreas(items)
    return render_template(
        "production/masonry_works/walls.html",
        title="Walls",
        items=items,
        total=total,
        categories=Categories(Wall),
    )
示例#2
0
 def validate_local_id(self, local_id):
     if local_id.data != self.original_local_id:
         ids = [
             wall.local_id
             for wall in Wall.get_all_items(self.invest_id).all()
         ]
         if local_id.data in ids:
             raise ValidationError("Id must be unique!")