Skip to main content

README

PyPI version PyPI Supported Python Versions

django-viewcomponent is a Django library that provides a way to create reusable components for your Django project.

It is inspired by Rails ViewComponent, which built by GitHub.com

For more insights into the problem it addresses and its design philosophy, check out this video by GitHub Staff member Joel Hawksley

Use Component in Django Template

You can create components and use them in Django templates.

Use Component in Django Template

Use Component in Python

Or you can create components and use them in pure Python code.

Use Component in Python

Why use django-viewcomponent

Single responsibility

django-viewcomponent can help developers to build reusable components from the Django templates, and make the templates more readable and maintainable.

Testing

django-viewcomponent components are Python objects, so they can be easily tested without touching Django view and Django urls.

Documentation

Documentation

FAQ

django-viewcomponent vs django-components

  1. django-viewcomponent is inspired by Rails ViewComponent, focusing solely on encapsulating Django templates without concerning itself with other elements such as frontend assets or generating Django responses.
  2. The slot field in django-viewcomponent can be invoked multiple times to pass collections.
  3. In django-viewcomponent, slot fields are declared in the Python component file rather than in the template file, making the slot field more flexible and easier to maintain.
  4. django-viewcomponent includes a preview feature that allows developers to easily create component previews.

Metadata

Release files for django-viewcomponent 1.0.11

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-viewcomponent 1.0.11
File Size Uploaded
django_viewcomponent-1.0.11.tar.gz 10.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-viewcomponent 1.0.11
File Interpreter ABI Platform
django_viewcomponent-1.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 24.1 kB

Release files / django_viewcomponent-1.0.11.tar.gz

Download URL django_viewcomponent-1.0.11.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
21c535af2fadde494f830e38fd4807ce6ccf12f2501f83c3f62a4b43288909f2
BLAKE2b-256 checksum
How to use checksums
838a596e501a193d1897b616e4e8481bf614c7b336718a520c03ed9782efb966
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / django_viewcomponent-1.0.11-py3-none-any.whl

Download URL django_viewcomponent-1.0.11-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa4f1bf93ab2fc153a73ae9ad73ce85fd22fd3d225bd89f9274d10e1a03934d0
BLAKE2b-256 checksum
How to use checksums
cb450d8830cdc9f097f1aa09fca21960b1b64e097d8f0275722af533aed96c62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release history Release notifications | RSS feed

This release

1.0.11 This release

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.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