Skip to main content

Toggle control for Flask Admin inline form.

Project description

Flask-Admin-Toggle-Control

Better boolean toggle control for Flask-Admin inline form.

Better UX

Replace this:

https://raw.githubusercontent.com/artemShelest/flask-admin-toggle-control/master/res/original.gif

with this:

https://raw.githubusercontent.com/artemShelest/flask-admin-toggle-control/master/res/new.gif

Installation

pip install flask-admin-toggle-control

Integrate

Edit your view class to integrate toggle control:

  1. Inherit from ViewMixin:

    class SomeView(flask_admin_toggle_control.ViewMixin, ModelView):
        pass
  2. Define fields to show with toggle control:

    class SomeView(flask_admin_toggle_control.ViewMixin, ModelView):
        column_toggle_control_list = ["boolean_field1", "boolean_field2"]
  3. Do not forget to have these fields editable:

    class SomeView(flask_admin_toggle_control.ViewMixin, ModelView):
        column_toggle_control_list = ["boolean_field1", "boolean_field2"]
        column_editable_list = ["boolean_field1", "boolean_field2", "other_editable_field"]

Serve component JS file from static endpoint, pass your application object as a parameter:

app = Flask(__name__)
flask_admin_toggle_control.init_static_ep(app)

Changelog

0.1.3

  • Added installation and integration instructions

  • Extracted view mixin for easier integration

  • Helper to create static endpoint

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-Admin-Toggle-Control-0.1.3.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file Flask-Admin-Toggle-Control-0.1.3.tar.gz.

File metadata

  • Download URL: Flask-Admin-Toggle-Control-0.1.3.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/38.2.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.13

File hashes

Hashes for Flask-Admin-Toggle-Control-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7d123c56fc2d747f131343283f3c6c6fab91fcc67e0fd8321523d1ca613d21d1
MD5 2cd5a2cbbf316f04271c36ef22aeb121
BLAKE2b-256 34ba70c596c2839701f79e4f269ce0f07a127552699bdb0448beccc48e5af52e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page