# README
[](https://badge.fury.io/py/django-viewcomponent)
[](https://pypi.python.org/pypi/django-viewcomponent/)
django-viewcomponent is a Django library that provides a way to create reusable components for your Django project.
It is inspired by Rails [ViewComponent](https://viewcomponent.org/), 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](https://youtu.be/QoetqsBCsbE?si=28PCFCD4N4CyfKY7&t=624)
## 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
[Documentation](https://django-viewcomponent.readthedocs.io/en/latest/)
## FAQ
### django-viewcomponent vs django-components
1. **django-viewcomponent** is inspired by Rails [ViewComponent](https://viewcomponent.org/), 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/rails-inspire-django/django-viewcomponent",
"name": "django-viewcomponent",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Michael Yin",
"author_email": "michaelyin@accordbox.com",
"download_url": "https://files.pythonhosted.org/packages/83/8a/596e501a193d1897b616e4e8481bf614c7b336718a520c03ed9782efb966/django_viewcomponent-1.0.11.tar.gz",
"platform": null,
"description": "# README\n\n[](https://badge.fury.io/py/django-viewcomponent)\n[](https://pypi.python.org/pypi/django-viewcomponent/)\n\ndjango-viewcomponent is a Django library that provides a way to create reusable components for your Django project.\n\nIt is inspired by Rails [ViewComponent](https://viewcomponent.org/), which built by GitHub.com\n\nFor more insights into the problem it addresses and its design philosophy, check out [this video by GitHub Staff member Joel Hawksley](https://youtu.be/QoetqsBCsbE?si=28PCFCD4N4CyfKY7&t=624)\n\n## Use Component in Django Template\n\nYou can create components and use them in Django templates.\n\n\n\n## Use Component in Python\n\nOr you can create components and use them in pure Python code.\n\n\n\n## Why use django-viewcomponent\n\n### Single responsibility\n\ndjango-viewcomponent can help developers to build reusable components from the Django templates, and make the templates more readable and maintainable.\n\n### Testing\n\ndjango-viewcomponent components are Python objects, so they can be **easily tested** without touching Django view and Django urls.\n\n## Documentation\n\n[Documentation](https://django-viewcomponent.readthedocs.io/en/latest/)\n\n## FAQ\n\n### django-viewcomponent vs django-components\n\n1. **django-viewcomponent** is inspired by Rails [ViewComponent](https://viewcomponent.org/), focusing solely on encapsulating Django templates without concerning itself with other elements such as frontend assets or generating Django responses.\n2. The `slot` field in **django-viewcomponent** can be invoked multiple times to pass collections.\n3. 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.\n4. **django-viewcomponent** includes a preview feature that allows developers to easily create component previews.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Build reusable components in Django, inspired by Rails ViewComponent",
"version": "1.0.11",
"project_urls": {
"Changelog": "https://github.com/rails-inspire-django/django-viewcomponent/releases",
"Homepage": "https://github.com/rails-inspire-django/django-viewcomponent"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cb450d8830cdc9f097f1aa09fca21960b1b64e097d8f0275722af533aed96c62",
"md5": "ac228e9613331c24bb1e1c0da61e5fa0",
"sha256": "aa4f1bf93ab2fc153a73ae9ad73ce85fd22fd3d225bd89f9274d10e1a03934d0"
},
"downloads": -1,
"filename": "django_viewcomponent-1.0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ac228e9613331c24bb1e1c0da61e5fa0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 14077,
"upload_time": "2025-01-07T02:15:56",
"upload_time_iso_8601": "2025-01-07T02:15:56.388751Z",
"url": "https://files.pythonhosted.org/packages/cb/45/0d8830cdc9f097f1aa09fca21960b1b64e097d8f0275722af533aed96c62/django_viewcomponent-1.0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "838a596e501a193d1897b616e4e8481bf614c7b336718a520c03ed9782efb966",
"md5": "56ced5e4f2be1aadf08ce1357c282abe",
"sha256": "21c535af2fadde494f830e38fd4807ce6ccf12f2501f83c3f62a4b43288909f2"
},
"downloads": -1,
"filename": "django_viewcomponent-1.0.11.tar.gz",
"has_sig": false,
"md5_digest": "56ced5e4f2be1aadf08ce1357c282abe",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 10006,
"upload_time": "2025-01-07T02:15:58",
"upload_time_iso_8601": "2025-01-07T02:15:58.405375Z",
"url": "https://files.pythonhosted.org/packages/83/8a/596e501a193d1897b616e4e8481bf614c7b336718a520c03ed9782efb966/django_viewcomponent-1.0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-07 02:15:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rails-inspire-django",
"github_project": "django-viewcomponent",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "django-viewcomponent"
}