CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-flask-admin

Simple and extensible admin interface framework for Flask

86

1.30x

Quality

Pending

Does it follow best practices?

Impact

86%

1.30x

Average score across 10 eval scenarios

Overview
Eval results
Files

task.mdevals/scenario-6/

Multilingual Product Admin Interface

Create a simple product management admin interface for a Flask application that supports multiple languages (English and Spanish). The interface should allow users to view and manage products, with all UI elements properly translated based on the user's language preference.

Requirements

Build a Flask-Admin interface with the following features:

  1. Product Model: A simple product model with the following fields:

    • name (text)
    • description (text)
    • price (decimal)
    • in_stock (boolean)
    • created_at (datetime)
  2. Admin Interface: Create an admin view for the Product model with:

    • List view showing all product fields
    • Create and edit forms
    • Column labels that display in Spanish when the user's locale is 'es'
    • Form field labels that display in Spanish when the user's locale is 'es'
  3. Language Support: The application should support:

    • English (default language)
    • Spanish (locale code 'es')
    • Translations for these UI elements: "Name", "Description", "Price", "In Stock", "Created At"
  4. Test Implementation: Write tests to verify:

    • Column labels appear in Spanish when locale is set to 'es' @test
    • Form field labels appear in Spanish when locale is set to 'es' @test
    • Column labels appear in English when locale is set to 'en' (default) @test

Implementation Files

@generates

API

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

class ProductView(ModelView):
    """
    Admin view for Product model with internationalization support.

    Should configure column_labels with translated strings for supported languages.
    Should use appropriate translation functions to enable language switching.
    """
    pass

def create_admin_interface(app: Flask, db: SQLAlchemy) -> Admin:
    """
    Create and configure the Flask-Admin interface with i18n support.

    Args:
        app: Flask application instance
        db: SQLAlchemy database instance

    Returns:
        Configured Admin instance with ProductView registered
    """
    pass

Dependencies { .dependencies }

flask-admin { .dependency }

Provides admin interface framework with internationalization support.

flask-babel { .dependency }

Provides internationalization and localization support for Flask applications.

flask-sqlalchemy { .dependency }

Provides SQLAlchemy integration for Flask.

Install with Tessl CLI

npx tessl i tessl/pypi-flask-admin

tile.json