tessl install tessl/pypi-flask-admin@1.6.0Simple and extensible admin interface framework for Flask
Agent Success
Agent success rate when using this tile
86%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.3x
Baseline
Agent success rate without this tile
66%
Build a Flask-Admin interface for managing product inventory with custom batch operations to streamline administrative workflows.
Create a ModelView for managing products with the following batch action capabilities:
featured field to True and displays a success message showing the count of updated products @testdiscontinued field to True with a confirmation prompt "Are you sure you want to discontinue selected products?" @teststock field to 0 for all selected products and commits the changes within a transaction @test@generates
from flask_admin.contrib.sqla import ModelView
from flask import flash
class ProductModelView(ModelView):
"""Admin view for Product model with custom batch actions."""
def __init__(self, model, session, **kwargs):
"""
Initialize the ProductModelView.
Args:
model: The Product SQLAlchemy model
session: SQLAlchemy session object
**kwargs: Additional keyword arguments for ModelView
"""
passThe Product model has the following structure (provided for reference):
from sqlalchemy import Column, Integer, String, Boolean, Float
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Product(Base):
__tablename__ = 'products'
id = Column(Integer, primary_key=True)
name = Column(String(100), nullable=False)
price = Column(Float, nullable=False)
stock = Column(Integer, default=0)
featured = Column(Boolean, default=False)
discontinued = Column(Boolean, default=False)Provides admin interface framework with batch action capabilities.
@satisfied-by
Provides ORM for database operations and model management.
@satisfied-by
Provides web framework and flash messaging functionality.
@satisfied-by