Skip to main content

Flexible view system to help you build views quickly.

https://github.com/radiac/django-fastview/actions/workflows/ci.yml/badge.svg https://codecov.io/gh/radiac/django-fastview/branch/develop/graph/badge.svg?token=5VZNPABZ7E Documentation Status

Fastview slashes development time for modern hybrid frontends - build comprehensive yet customisable CRUD views in a couple of lines, with built-in HTMX support.

  • Create a view group to manage models - list, read, create, update and delete views

  • All views are class-based, so they’re quick and easy to customise

  • Default templates are designed to be customised or replaced to fit your design

  • Advanced permission system allows fine-grained row-level access control

  • Built-in support for HTMX (coming soon), inline model formsets and more

Note: this is an alpha release; expect feature and API changes in future versions. Check upgrade notes for instructions when upgrading.

Example

Lets write a wiki where anyone can view, add, edit and delete pages:

# urls.py (for example purposes - normally define the viewgroup in app/views.py)
from fastview.viewgroups import ModelViewGroup
from fastview.permissions import Public
from mywiki.models import Wiki

class WikiViewGroup(ModelViewGroup):
    model = Wiki
    permission = Public()

urlpatterns = [
    url(r'^wiki/', WikiViewGroup().include(namespace="wiki")),
]

This will create a functioning set of list, detail, create, update and delete views under the /wiki/ path on your site.

There are all sorts of things you can do from here:

  • The views are all based on Django’s generic class-based views, so they’re easy to customise

  • Easy and flexible permissions to control who can do what

See the Tutorial in the documentation for more details.

Quickstart

  1. Install using pip:

    pip install django-fastview
  2. Add to INSTALLED_APPS:

    INSTALLED_APPS = [
        ...
        "fastview",
    ]
  3. Optional: add the default JavaScript and CSS to your templates or frontend build process.

See Getting Started in the documentation for more details.

Advanced example

Build a more complex view group with custom view classes and complex access controls:

# urls.py (for example purposes)
from fastview.viewgroups import ModelViewGroup
from fastview.permissions import Public, Login, Staff, Owner, Django
from myblog.models import Blog
from myblog.views import BlogUpdateView, BlogPublishView

class BlogViewGroup(ModelViewGroup):
    model = Blog

    # Default permission for views - any views without explicit permissions will
    # require that user is logged in
    permission = Login()

    # Make the list view public by reconfiguring it with a call to View.config()
    list_view = fastview.views.generics.ListView.config(
        permission=Public(),
    )

    # Make the detail view public by reconfiguring it with the dict shorthand format
    detail_view = dict(
        permission=Public(),
    )

    # Override update with a custom view, and limit access to staff or post owners
    update_view = BlogUpdateView.config(
        permission=Staff() | Owner("owner"),
    )

    # Use the Django permission framework to manage who can delete Blog objects
    delete_view = dict(
        permission=Django("delete"),
    )

    # Add a publish view where only staff can access, but only if it's not their own
    publish_view = BlogPublishView.config(
        permission=Staff() & ~Owner("owner"),
    )

urlpatterns = [
    url(r'^blog/', BlogViewGroup().include(namespace="blog")),
]

You may then want to create a custom templates at templates/myblog/blog/list.html and templates/myblog/blog/detail.html to change the way blog posts are rendered.

For more details see the main documentation.

More examples

See Examples in the documentation for more details on these two examples, as well as how you can use fastview to:

  • configure and customise the views

  • use permissions to control access to individual database objects

  • add inline models to your forms

  • and more

Release files for django-fastview 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-fastview 0.1.0
File Size Uploaded
django-fastview-0.1.0.tar.gz 49.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-fastview 0.1.0
File Interpreter ABI Platform
django_fastview-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 102.3 kB

Release files / django-fastview-0.1.0.tar.gz

Download URL django-fastview-0.1.0.tar.gz
Size 49.8 kB
Tags Source
SHA-256 checksum
How to use checksums
553bfecddebe4406a2a1b4db797e848d15da664df9af0be53ae6298d619b9c27
BLAKE2b-256 checksum
How to use checksums
f35ca2bbabde38f7b4a2949830f18fac2d3ebdad7880a65f1dbb0f679d7e56a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / django_fastview-0.1.0-py3-none-any.whl

Download URL django_fastview-0.1.0-py3-none-any.whl
Size 52.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9cbaf2e1903f3e85bbda9c1c0c08e6f2c3880eaf79ff3d1299f91144bd380d09
BLAKE2b-256 checksum
How to use checksums
165a19c761c806f2a51c38f862059632fc3a279eca11afa3c52ca9006bd22810
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.3

1 release file

0.0.2

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page