Ctrl + k

or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/flask-admin@1.6.x
tile.json

tessl/pypi-flask-admin

tessl install tessl/pypi-flask-admin@1.6.0

Simple 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%

task.mdevals/scenario-4/

Product Inventory Management System

Build a Flask-Admin interface for managing product inventory with custom batch operations to streamline administrative workflows.

Capabilities

Batch Product Operations

Create a ModelView for managing products with the following batch action capabilities:

  • Implements a "Mark as Featured" batch action that sets selected products' featured field to True and displays a success message showing the count of updated products @test
  • Implements a "Discontinue Products" batch action that sets selected products' discontinued field to True with a confirmation prompt "Are you sure you want to discontinue selected products?" @test
  • Implements a "Reset Stock" batch action that sets the stock field to 0 for all selected products and commits the changes within a transaction @test
  • The batch delete action is disabled by removing it from available actions @test

Implementation

@generates

API

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
        """
        pass

Database Model

The 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)

Dependencies { .dependencies }

flask-admin { .dependency }

Provides admin interface framework with batch action capabilities.

@satisfied-by

SQLAlchemy { .dependency }

Provides ORM for database operations and model management.

@satisfied-by

Flask { .dependency }

Provides web framework and flash messaging functionality.

@satisfied-by