{"id":16417323,"url":"https://github.com/rails-inspire-django/django-viewcomponent","last_synced_at":"2025-10-05T07:25:18.159Z","repository":{"id":227220805,"uuid":"770258934","full_name":"rails-inspire-django/django-viewcomponent","owner":"rails-inspire-django","description":"Build reusable components in Django, inspired by Rails ViewComponent","archived":false,"fork":false,"pushed_at":"2025-01-11T02:53:18.000Z","size":2356,"stargazers_count":57,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T03:35:45.113Z","etag":null,"topics":["component","django"],"latest_commit_sha":null,"homepage":"https://django-viewcomponent.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rails-inspire-django.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-11T08:35:49.000Z","updated_at":"2025-01-11T02:53:23.000Z","dependencies_parsed_at":"2025-01-03T02:29:44.198Z","dependency_job_id":"a899e06f-4995-4bb0-bce2-d7490525157d","html_url":"https://github.com/rails-inspire-django/django-viewcomponent","commit_stats":null,"previous_names":["rails-inspire-django/django-viewcomponent"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rails-inspire-django%2Fdjango-viewcomponent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rails-inspire-django%2Fdjango-viewcomponent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rails-inspire-django%2Fdjango-viewcomponent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rails-inspire-django%2Fdjango-viewcomponent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rails-inspire-django","download_url":"https://codeload.github.com/rails-inspire-django/django-viewcomponent/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238394323,"owners_count":19464583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["component","django"],"created_at":"2024-10-11T07:11:26.455Z","updated_at":"2025-10-05T07:25:13.117Z","avatar_url":"https://github.com/rails-inspire-django.png","language":"Python","funding_links":[],"categories":["Python","Django"],"sub_categories":["Helpers"],"readme":"# README\n\n[![PyPI version](https://badge.fury.io/py/django-viewcomponent.svg)](https://badge.fury.io/py/django-viewcomponent)\n[![PyPI Supported Python Versions](https://img.shields.io/pypi/pyversions/django-viewcomponent.svg)](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\u0026t=624)\n\n## Use Component in Django Template\n\nYou can create components and use them in Django templates.\n\n![Use Component in Django Template](.github/assets/component-in-template.png)\n\n## Use Component in Python\n\nOr you can create components and use them in pure Python code.\n\n![Use Component in Python](.github/assets/component-in-py.png)\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frails-inspire-django%2Fdjango-viewcomponent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frails-inspire-django%2Fdjango-viewcomponent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frails-inspire-django%2Fdjango-viewcomponent/lists"}