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

Book Library Admin Interface with Search

Build a simple book library admin interface that allows users to search for books using various pattern matching techniques.

Requirements

Create a Flask application with an admin interface for managing a book library. The application should support searching books by multiple criteria with different pattern matching options.

Data Model

Implement a Book model with the following fields:

  • id: Integer, primary key
  • title: String (200 characters max), required
  • author: String (200 characters max), required
  • isbn: String (20 characters max), unique
  • publisher: String (100 characters max)
  • published_year: Integer
  • description: Text

Search Functionality

Implement search capability that allows users to find books using:

  1. Default pattern matching (contains) for title and author fields
  2. Exact match pattern (using = prefix) for ISBN lookups
  3. Starts-with pattern (using ^ prefix) for publisher searches
  4. Case-insensitive search across all searchable fields

The search should work across multiple columns simultaneously and return results that match the search term in any of the configured searchable fields.

Admin Interface

Set up an admin interface with:

  • A list view showing all books with columns: title, author, isbn, publisher, published_year
  • Search functionality enabled on: title, author, isbn, publisher
  • Basic create and edit capabilities for managing books

Test Cases

@test Create a test file test_search.py that verifies:

  1. Default Contains Search: Search for "Python" should find books with "Python" anywhere in title, author, publisher, or ISBN

    • Given a book with title "Learning Python"
    • When searching for "Python"
    • Then the book should appear in results
  2. Exact Match Search: Search for "=978-0134685991" should find only the book with exactly that ISBN

    • Given a book with ISBN "978-0134685991" and another with ISBN "978-0134685991-EXTRA"
    • When searching for "=978-0134685991"
    • Then only the book with exact ISBN "978-0134685991" should appear
  3. Starts-With Search: Search for "^O'Reilly" should find books from publishers starting with "O'Reilly"

    • Given books published by "O'Reilly Media" and "Penguin Random House"
    • When searching for "^O'Reilly"
    • Then only books from "O'Reilly Media" should appear
  4. Case-Insensitive Search: Search for "python" (lowercase) should find books with "Python" (capitalized) in any field

    • Given a book with author "Python Institute"
    • When searching for "python" (lowercase)
    • Then the book should appear in results

Dependencies { .dependencies }

flask { .dependency }

Web framework for building the application.

flask-admin { .dependency }

Admin interface framework with search functionality.

flask-sqlalchemy { .dependency }

Database ORM integration for Flask.

Deliverables

  1. A Flask application (app.py) with the Book model and admin interface configured
  2. Test file (test_search.py) implementing the four test cases
  3. Database initialization code to create tables

The solution should demonstrate proper configuration of search capabilities including pattern matching options.

Install with Tessl CLI

npx tessl i tessl/pypi-flask-admin

tile.json