Skip to main content

Flask extension for providing class-based views

Project description

Flask-Classical

Flask extension for providing class-based views.

The following views are provided: CreateView, EditView, DeleteView

Installation

$ pip install Flask-Classical

Usage

First create and initialize the cbv object:

from flask_cbv import Cbv
cbv = Cbv(db, wtf)
# db is your Flask-Alchemist instance
# wtf is your Flask-Formist instance

And then you can add routes, for example:

entries_blueprint.add_url_rule(
    "/<int:obj_id>/edit/",
    view_func=login_required(
        cbv.EditView.as_view(
            "edit_entry",
            form_cls=EntryForm,
            template="entries/edit_entry.html",
            obj_cls=Entry,
            blueprint="entries",
            validators=(current_user_is_author,),
        )
    ),
    methods=("GET", "POST"),
)

License

Flask-Classical was created by Rafal Padkowski. It is licensed under the terms of the MIT license.

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_classical-0.1.0.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

flask_classical-0.1.0-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

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