Skip to main content

Class based views for Flask

Project description

Flask-Views is a Flask extension which provides a set of class-based views, inspired by the Django class based views.

Currently this package contains a set of views for rendering (template and JSON) responses dispatched by HTTP request method, views for handling (WTForms) form submission and a collection of database views for creating and updating objects (currently MongoDB is supported by using Mongoengine).


Flask-Views can be installed by executing pip install flask-views. The source is available at:


Contact form

from flask_views.edit import FormView

class ContactFormView(FormView):
    # For creating forms classes, see the WTForms documentation
    form_class = ContactForm
    template_name = 'contact_form.html'

    def form_valid(self, form):
        # Do something with the submitted form data
        return super(ContactFormView, self).form_valid(form)

    def get_success_url(self):
        return url_for('contact.form')


Article view

from flask_views.db.mongoengine.detail import DetailView

class ArticleView(DetailView):
    get_fields = {
        'category': 'category',
        'slug': 'slug',
    # For creating document classes, see the Mongoengine documentation
    document_class = Article
    template_name = 'article_detail.html'


Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
Flask-Views-0.2.1.tar.gz (24.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page