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-5/

Product Review Admin System

A Flask-Admin application for managing product reviews in an e-commerce platform with large datasets.

Context

You're building an admin interface for a product review system. The database contains thousands of products and tens of thousands of reviews. When creating or editing a review through the admin interface, selecting a product from a standard dropdown becomes impractical due to the large number of products.

Requirements

Build a Flask-Admin interface that efficiently handles review management with the following specifications:

Data Model

Create two SQLAlchemy models:

  1. Product: Represents products in the system

    • id: Integer primary key
    • name: String (200 characters max)
    • sku: String (50 characters max), unique identifier
    • category: String (100 characters max)
  2. Review: Represents customer reviews

    • id: Integer primary key
    • product_id: Foreign key to Product
    • rating: Integer (1-5)
    • comment: Text field
    • reviewer_name: String (100 characters max)
    • created_at: DateTime with default to current time

Admin Interface

Create a Flask application with Flask-Admin that:

  1. Provides a ModelView for managing reviews

  2. Implements efficient product selection in review forms that:

    • Loads product options dynamically via AJAX
    • Displays paginated results (10 items per page)
    • Allows searching across product name, SKU, and category
    • Shows a placeholder message "Search for a product..."
    • Requires at least 1 character input before searching
  3. Allows all standard CRUD operations on reviews

  4. Uses SQLite database for storage

Test Cases

  • Creating a review with AJAX-loaded product selection returns a successful response @test
  • The review form includes a product selection field that supports AJAX loading @test
  • The AJAX endpoint for product lookup returns paginated results (page size of 10) @test
  • Searching for products by name through the AJAX endpoint returns matching products @test

Implementation

@generates

API

"""
Flask-Admin application for product review management with AJAX foreign key loading.
"""

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView
from datetime import datetime

# Database models and admin views should be implemented here
# The application should be runnable and provide the admin interface

Dependencies { .dependencies }

Flask-Admin { .dependency }

Provides admin interface framework with AJAX foreign key loading capabilities.

Flask-SQLAlchemy { .dependency }

Provides SQLAlchemy integration for Flask.