Skip to main content

Django’s class based generic views are a great way to reuse code and avoid boilerplate. In Django, however, each view is associated with a single URL. If you want to reuse some behavior that involves multiple urls it is often necessary to synchronize many different views. Think about a CRUD interface: it is not necessarily hard, but it can be both tedious and error prone.

View packs gather a collection of views and url entry points together in a single reusable unity. Hence, instead of creating separate CreateView, DetailView, UpdateView, DeleteView, etc, we can simply subclass the CRUDViewPack view pack:

from viewpack import CRUDViewPack
from fooapp.models import FooModel


class FooCRUD(CRUDViewPack):
    model = FooModel

In your urls.py, register all CRUD views as an include:

from django.conf import url
from views import FooCRUD


urlpatterns = [
    ...,
    url(r'^foo/', FooCRUD.as_include(namespace='foo')),
]

Now you have registered a simple CRUD interface for your FooModel. The next step is to write the required templates and you’re done! (In fact, if you are lazy and use Jinja, we even offer a few ready to use templates!)

Metadata

Release files for django-viewpack 0.1.4

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-viewpack 0.1.4
File Size Uploaded Provenance Actions
django-viewpack-0.1.4.tar.gz 20.9 kB Without provenance Details for django-viewpack-0.1.4.tar.gz

Release files / django-viewpack-0.1.4.tar.gz

Download URL django-viewpack-0.1.4.tar.gz
Size 20.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f779eb25910a1c97d9d3cbdf2e7629362574f0489f185feba08c1d1b57db8b40
BLAKE2b-256 checksum
How to use checksums
e0eba081de727fba4ff320fdc22bdb9f2c338dcb0a52cad9a50ce9663a22d2d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-viewpack 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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