Build reusable components in Django, inspired by Rails ViewComponent
Project description
README
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 Python
Or you can create components and use them in pure Python code.
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
FAQ
django-viewcomponent vs django-components
- 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.
- The
slot
field in django-viewcomponent can be invoked multiple times to pass collections. - 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.
- django-viewcomponent includes a preview feature that allows developers to easily create component previews.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_viewcomponent-1.0.9.tar.gz
.
File metadata
- Download URL: django_viewcomponent-1.0.9.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fc9e7478341c689a4750e8078fbd639eac6f91eebcdfc77a8c050ef1a5beeff |
|
MD5 | 06f0116d8581beff0326c666a8ef809b |
|
BLAKE2b-256 | 69400c13727e0b0a3ec00ff8f26d2f265fa45e9ed4b8bc7c822b9ff7aa88fb21 |
File details
Details for the file django_viewcomponent-1.0.9-py3-none-any.whl
.
File metadata
- Download URL: django_viewcomponent-1.0.9-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 859a0f3a27a41bb65ce0d08c7085d74a118ce15cf2215a3e792ba2b2fc07b25a |
|
MD5 | 33eaceeb264b97a9d1d802ee2be0bc3b |
|
BLAKE2b-256 | 64e5b889cf1e99bc4ea13d86830b6293459aa39bc2dce14fa929dd35e7ef8cb1 |