Simple and extensible admin interface framework for Flask
86
Quality
Pending
Does it follow best practices?
Impact
86%
1.30xAverage score across 10 eval scenarios
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
Install with Tessl CLI
npx tessl i tessl/pypi-flask-admindocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10