This package is no longer distributed on PyPI.
You can now review and download packages at our own Python registry- https://balto.baltorepo.com/open-source/python/packages/drf-form-bootstrap-4/
drf-form-bootstrap-4
Bootstrap 4 templates for Django REST Framework render_form tag.
Requirements
Tested with Django 2.2, DRF 3.9, Python 3.6 & 3.5. Almost certainly works in earlier versions.
Installation
From PyPI:
pip install drf-form-bootstrap-4
Add drfformbootstrap4 to your INSTALLED_APPS setting.
INSTALLED_APPS = (
...
'drfformbootstrap4',
)
Usage
Like the template packs in Django REST Framework, this supports three layouts:
Vertical
<form method="POST" novalidate>
{% csrf_token %}
{% render_form serializer template_pack='drfformbootstrap4/vertical' %}
<div class="row">
<div class="col text-right">
<input class="btn btn-primary" type="submit" value="Submit">
</div>
</div>
</form>
Horizontal
<form method="POST" novalidate>
{% csrf_token %}
{% render_form serializer template_pack='drfformbootstrap4/horizontal' %}
<div class="row">
<div class="col text-right">
<input class="btn btn-primary" type="submit" value="Submit">
</div>
</div>
</form>
Inline
Note that inline is less well-tested than the others, and at the moment the error states don't render properly. If this is a problem for you, add a comment to this issue.
<form method="POST" novalidate class="form-inline">
{% csrf_token %}
{% render_form serializer template_pack='drfformbootstrap4/inline' %}
<div class="row">
<div class="col text-right">
<input class="btn btn-primary" type="submit" value="Submit">
</div>
</div>
</form>
Additional Options
Use the style field on your serializer to change the appearance of a field.
To display a field as text instead of as a field:
style={'class': 'form-control-plaintext'}
For inline checkboxes and radio buttons:
style={'inline': True}
Prepend/append text for inputs:
style={
'prepend': 'text to prepend',
'append': 'text to append',
}
Development
Pretty standard: fork this repo, make changes, make a GitHub pull request.
There are demo pages showing a variety of form fields and layouts. To use it, first install its dependencies:
pip install -r requirements.txt
Then run the server:
make runserver
When using this runserver, you don't need to install drfformbootstrap4 into your virtualenv before seeing changes. However if you want to see your changes reflected in a different application using the same virtualenv, install it with:
make install
Builds are here: https://travis-ci.org/mattfox/drf-form-bootstrap-4
License
© 2019 Matthew Fox
Metadata
Release files for drf-form-bootstrap-4 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| drf-form-bootstrap-4-0.5.2.tar.gz | 10.6 kB | Without provenance | Details |
Release files / drf-form-bootstrap-4-0.5.2.tar.gz
| Download URL | drf-form-bootstrap-4-0.5.2.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47e0c306b391d59076bedef69eae1fbefccd56f09cd28c3da42e280027a9325e
|
|
BLAKE2b-256 checksum How to use checksums |
e53448e5981c3695e67b9583b432cc2a89bfb45239765914f0a65444f83e8b47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.0
|
Security for drf-form-bootstrap-4 0.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.