{"id":22293553,"url":"https://github.com/xi/django-bs","last_synced_at":"2026-04-11T00:16:06.588Z","repository":{"id":150048227,"uuid":"236304200","full_name":"xi/django-bs","owner":"xi","description":"Bootstrap integration for django using widget templates","archived":false,"fork":false,"pushed_at":"2024-03-06T17:53:49.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-02T00:17:46.066Z","etag":null,"topics":["bootstrap","django"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","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":"2020-01-26T11:42:45.000Z","updated_at":"2023-04-18T19:48:06.000Z","dependencies_parsed_at":"2024-12-03T17:30:08.796Z","dependency_job_id":"098367b2-47bd-4894-ad76-b37475624e61","html_url":"https://github.com/xi/django-bs","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xi%2Fdjango-bs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xi%2Fdjango-bs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xi%2Fdjango-bs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xi%2Fdjango-bs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xi","download_url":"https://codeload.github.com/xi/django-bs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245550681,"owners_count":20633883,"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":["bootstrap","django"],"created_at":"2024-12-03T17:29:35.306Z","updated_at":"2025-12-30T23:26:04.201Z","avatar_url":"https://github.com/xi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Bootstrap forms for Django\n==========================\n\nBootstrap integration for django using [widget templates].\n\nMotivation\n----------\n\nThis library is meant to be a drop-in replacement for [django-bootstrap5]. See\nbelow for a list of differences. I really like that library, but it is hard to\ncustomize some things because everything is done in python functions. By using\nwidget templates, I hope this library is more flexible.\n\nInstallation\n------------\n\nInstall with pip:\n\n    pip install 'django-bs==4.*'  # for bootstrap 4\n    pip install 'django-bs==5.*'  # for bootstrap 5\n\nAfter that you have to add it to `INSTALLED_APPS`. You also need to make sure\nthat the correct `FORM_RENDERER` is selected and `django.forms` is in\n`INSTALLED_APPS` (after `django_bs`). This is required so that widget\ntemplates can be overwritten:\n\n    INSTALLED_APPS = [\n        …\n        'django_bs',\n        …\n        'django.forms',\n        …\n    ]\n\n    FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'\n\nUsage\n-----\n\nThe following template tags are included in the `bootstrap` library:\n\n-   `bootstrap_field {boundfield}` - Render a single field.\n-   `bootstrap_form {form}` - Render errors and all fields for a form. The\n    `\u003cform\u003e` element itself is not included.\n-   `bootstrap_messages` - Render messages from `django.contrib.messages`.\n-   `bootstrap_pagination {page}` - Render pagination. You should wrap it in a\n    `\u003cnav\u003e` element with a meaningful `aria-label` yourself.\n\nPlease refer to the source code for additional parameters.\n\nDifferences to django-bootstrap5\n--------------------------------\n\n-   Uses widget templates instead of custom renderers. IMHO this makes the code\n    much easier to read and customize. A big downside is that I had to\n    monkey-patch `BoundField.as_widget()` to include some information that\n    would otherwise not be available in the widget templates.\n-   Also overwrites the default form template in Django 4.0 and later so that\n    `{{ form }}` does the right thing automatically.\n-   Concentrates on form fields and does therefore not include some other\n    features.\n-   Uses `.form-text.text-danger` instead of `.invalid-feedback` as it does not\n    depend on DOM location. (see also [twbs/bootstrap\\#29439])\n-   Uses [Django's `required_css_class`]\n    which is defined on the `Form` class and added to the `\u003clabel\u003e`.\n-   Does not use `.is-valid` because I find it confusing with server-side\n    rendering.\n-   Does not include dismiss-buttons for alerts to avoid depending on\n    JavaScript.\n-   Non-field errors are styled as alerts.\n-   Improved accessibility.\n-   You will have to load bootstrap yourself.\n-   No configuration.\n\n[widget templates]: https://docs.djangoproject.com/en/stable/ref/forms/renderers/#overriding-built-in-widget-templates\n[django-bootstrap5]: https://github.com/zostera/django-bootstrap5\n[twbs/bootstrap\\#29439]: https://github.com/twbs/bootstrap/issues/29439\n[Django's `required_css_class`]: https://docs.djangoproject.com/en/stable/ref/forms/api/#django.forms.Form.required_css_class\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxi%2Fdjango-bs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxi%2Fdjango-bs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxi%2Fdjango-bs/lists"}