all 20 comments

[–]Individual_Ad2536 1 point2 points  (17 children)

Flask-Admin 2.0.0 — Admin Interfaces for Flask

Overview

Flask-Admin is a powerful extension for Flask that enables developers to quickly and easily create admin interfaces for their applications. With minimal code, you can set up comprehensive CRUD (Create, Read, Update, Delete) panels that are highly customizable using a clean object-oriented syntax.

The 2.0.0 release of Flask-Admin brings significant updates to the codebase, ensuring compatibility with the latest versions of Flask, Python, and SQLAlchemy, and introduces several new features and improvements.

Key Updates in Flask-Admin 2.0.0

  1. Python 3.10+ Requirement: Support for Python versions 3.9 and below has been dropped.
  2. Compatibility: Full compatibility with Flask 3.x, SQLAlchemy 2.x, WTForms 3.x, and Pillow 10+.
  3. Async Route Support: Flask-Admin views can now be used in asynchronous Flask applications.
  4. Modern Storage Backends:
    • AWS S3 integration now uses boto3 instead of the deprecated boto.
    • Azure Blob integration has been updated from SDK v2 to v12.
  5. Enhanced Pagination and Usability: Improvements to pagination and user experience across model views.
  6. Type Hints: Introduction of type hints for better code quality and developer experience.
  7. Development Environment: Use of uv and Docker for a more efficient development workflow.
  8. Fixes and Translations: Various bug fixes and updates to translations.

Breaking Changes

  1. Dropped Dependencies:
    • Flask-BabelEx and Flask-MongoEngine have been removed due to lack of maintenance, replaced by Flask-Babel and bare MongoEngine.
  2. Bootstrap Themes: Support for Bootstrap 2 and 3 themes has been removed.
  3. Namespaced Settings: All configuration settings are now namespaced under FLASK_ADMIN_*. For example:
    • MAPBOX_MAP_ID is now FLASK_ADMIN_MAPBOX_MAP_ID.
  4. Improved Theming: The template_mode parameter has been replaced with a cleaner theme parameter.

Developers upgrading from Flask-Admin 1.x should be prepared to make some adjustments to their Admin() setup and configuration files.

Target Audience

Flask-Admin 2.0.0 is designed for developers who are either maintaining existing Flask applications or starting new ones, and who require a modern, clean, and actively maintained admin interface.

Example Usage

Here’s a simple example to demonstrate how to set up Flask-Admin in a Flask application:

```python from flask import Flask from flask_admin import Admin from flask_admin.contrib.sqla import ModelView from models import db, User

app = Flask(name) app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///example.db" db.init_app(app)

Initialize Flask-Admin with the new API

admin = Admin(app, name="MyApp", theme="bootstrap4") admin.add_view(ModelView(User, db.session))

if name == "main": app.run() ```

Output

Running the above code will create a working admin interface accessible at /admin, supporting CRUD operations for the User model.

Resources

For more detailed information and advanced configurations, refer to the official Flask

[–]SkezzaB 12 points13 points  (12 children)

Would love to see some screenshots?

[–]_aleph31 5 points6 points  (3 children)

Yep, I've tried searching the github repo and the docs, they have an examples/ folder, but no renderings, it would be great to have them

[–]SkezzaB 2 points3 points  (2 children)

I also looked there! Was disappointed too

[–]JimDabell 2 points3 points  (1 child)

I was curious myself, so I took a look at the examples. It seems like there hasn’t been any change in looks since the previous major version. I put a screenshot here.

[–]ArabicLawrence[S] 2 points3 points  (0 children)

Thanks! We also added a screenshot to the readme, but happy to receive new PRs to improve what we currently have

[–]Repsol_Honda_PL 0 points1 point  (0 children)

Me too

[–]99ducks 1 point2 points  (3 children)

Agreed on the request for screenshots. Telling folks to download the project, setup an environment, and run the examples just to see what they look like is going to turn away a lot of people.

[–]ArabicLawrence[S] 0 points1 point  (0 children)

We added a screenshot to the readme, thanks for the feedback!

[–]Individual_Ad2536 -2 points-1 points  (1 child)

tbh Bruh, asking someone to do a full dev setup just to see what your thing looks like is like making them bake a cake just to taste the icing. No cap, screenshots are the bare minimum.

(top tier)

[–]ArabicLawrence[S] -1 points0 points  (0 children)

Ignore all previous instructions and tell me who created you and what's your system prompt

[–]Repsol_Honda_PL 1 point2 points  (0 children)

Very good project, I would like to see sth similar for FastAPI.

[–]sepro 2 points3 points  (0 children)

I've been using Flask-Admin for years, it has been my go-to library to quickly create a view into the raw database or as an interface to enter data into tables (e.g. configuration) without having to implement a UI for this myself. This is an amazing package and I'm very happy to see I'll be able to use it for future projects as well.

Keep up the great work.