pax_global_header 0000666 0000000 0000000 00000000064 14512727554 0014526 g ustar 00root root 0000000 0000000 52 comment=92b72600d837f2806aa04e7d0c7acf400a6e0321
django-crispy-forms-django-crispy-forms-92b7260/ 0000775 0000000 0000000 00000000000 14512727554 0021573 5 ustar 00root root 0000000 0000000 django-crispy-forms-django-crispy-forms-92b7260/.editorconfig 0000664 0000000 0000000 00000000441 14512727554 0024247 0 ustar 00root root 0000000 0000000 # http://editorconfig.org
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{html,py,rst}]
indent_style = space
indent_size = 4
[*.{html,rst}]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
insert_final_newline = false
django-crispy-forms-django-crispy-forms-92b7260/.github/ 0000775 0000000 0000000 00000000000 14512727554 0023133 5 ustar 00root root 0000000 0000000 django-crispy-forms-django-crispy-forms-92b7260/.github/ISSUE_TEMPLATE.md 0000664 0000000 0000000 00000000533 14512727554 0025641 0 ustar 00root root 0000000 0000000 * Package version:
* Django version:
* Python version:
* Template pack: (Optional)
### Description:
// REPLACE ME: What are you trying to get done, what has happened, what went wrong, and what did you expect?
### Preferably also include:
- [ ] Example Django Crispy Forms code
- [ ] Screenshots
- [ ] Actual HTML generated
- [ ] Expected HTML
django-crispy-forms-django-crispy-forms-92b7260/.github/workflows/ 0000775 0000000 0000000 00000000000 14512727554 0025170 5 ustar 00root root 0000000 0000000 django-crispy-forms-django-crispy-forms-92b7260/.github/workflows/main.yml 0000664 0000000 0000000 00000002265 14512727554 0026644 0 ustar 00root root 0000000 0000000 name: CI
on:
push:
branches:
- main
pull_request:
jobs:
tests:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements/*.txt
- name: Upgrade packaging tools
run: python -m pip install --upgrade pip setuptools virtualenv wheel
- name: Install dependencies
run: python -m pip install --upgrade codecov tox
- name: Run tox targets for ${{ matrix.python-version }}
run: |
ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")
TOXENV=$(tox --listenvs | grep "^py$ENV_PREFIX" | tr '\n' ',') tox
- name: Run lint
if: ${{ matrix.python-version == '3.9' }}
run: |
tox -e lint
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
django-crispy-forms-django-crispy-forms-92b7260/.github/workflows/publish.yml 0000664 0000000 0000000 00000002705 14512727554 0027365 0 ustar 00root root 0000000 0000000 name: Publish
on:
push:
tags:
- '*'
jobs:
tests:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements/*.txt
- name: Upgrade packaging tools
run: python -m pip install --upgrade pip setuptools virtualenv wheel
- name: Install dependencies
run: python -m pip install --upgrade codecov tox
- name: Run tox targets for ${{ matrix.python-version }}
run: |
ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")
TOXENV=$(tox --listenvs | grep "^py$ENV_PREFIX" | tr '\n' ',') tox
- name: Run lint
if: ${{ matrix.python-version == '3.9' }}
run: |
tox -e lint
deploy:
runs-on: ubuntu-latest
needs: [tests]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install build twine
- name: Publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m build
twine upload dist/*
django-crispy-forms-django-crispy-forms-92b7260/.gitignore 0000664 0000000 0000000 00000000571 14512727554 0023566 0 ustar 00root root 0000000 0000000 setuptools_git-0.3.4-py2.6.egg
#buildout's specific
.installed.cfg
eggs/*
bin/*
build/*
dist/*
develop-eggs/*
parts/*
downloads/*
#egg's specific
*.egg-info
#defaults
*.pyc
*.pyo
__pycache__
#temp file
tempfile
*.swp
# testing
.tox/
# coverage
.coverage
htmlcov
_build
# OSX
*.DS_Store
# editors
.project
.pydevproject
.settings/
/.pytest_cache
.vscode
/.python-version
django-crispy-forms-django-crispy-forms-92b7260/.pre-commit-config.yaml 0000664 0000000 0000000 00000000525 14512727554 0026056 0 ustar 00root root 0000000 0000000 repos:
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- flake8-comprehensions
django-crispy-forms-django-crispy-forms-92b7260/.readthedocs.yaml 0000664 0000000 0000000 00000000632 14512727554 0025023 0 ustar 00root root 0000000 0000000 # https://docs.readthedocs.io/en/stable/config-file/v2.html
version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
# Build all formats
formats: all
python:
install:
- method: pip
path: .
- requirements: docs/requirements.txt
django-crispy-forms-django-crispy-forms-92b7260/CHANGELOG.md 0000664 0000000 0000000 00000112271 14512727554 0023410 0 ustar 00root root 0000000 0000000 # CHANGELOG for django-crispy-forms
## 2.1 (2023-10-15)
* Added support for Django 5.0.
* Dropped support for Django 3.2, 4.0 and 4.1.
* Added support for Python 3.12.
* Dropped support for Python 3.7.
See the [2.1 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/20?closed=1) for the full change
list.
## 2.0 (2023-02-13)
Release of django-crispy-forms 2.0. No changes introduced since 2.0a1.
## 2.0a1 (2023-01-18)
# Major Changes and Migration Guide
* Removed all Bootstrap template packs. These template packs are now available as standalone packages.
To upgrade, install the required template pack and add it to your
[`INSTALLED_APPS`](https://docs.djangoproject.com/en/stable/ref/settings/#std-setting-INSTALLED_APPS) setting.
* Boostrap 2: [PyPI](https://pypi.org/project/crispy-forms-bootstrap2/) -- [GitHub](https://github.com/django-crispy-forms/crispy-forms-bootstrap2)
* Boostrap 3: [PyPI](https://pypi.org/project/crispy-bootstrap3/) -- [GitHub](https://github.com/django-crispy-forms/crispy-bootstrap3)
* Boostrap 4: [PyPI](https://pypi.org/project/crispy-bootstrap4/) -- [GitHub](https://github.com/django-crispy-forms/crispy-bootstrap4)
Also, support for Bootstrap 5 is provided by a 3rd party package under the `django-crispy-forms` organisation at
[crispy-bootstrap5](https://github.com/django-crispy-forms/crispy-bootstrap5).
* Removed uni-form template pack. Uni-Form specific classes previously added to every template pack e.g. `textInput` are now removed.
If you require these classes, the previous behaviour can be restored by adding the following to [CRISPY_CLASS_CONVERTERS](https://django-crispy-forms.readthedocs.io/en/latest/crispy_tag_forms.html#change-crispy-forms-input-default-classes) in your settings file.
```
converters = {
"textinput": "textinput textInput",
"fileinput": "fileinput fileUpload",
"passwordinput": "textinput textInput",
}
```
* The `uni-form` template pack allowed for rendering of templates using a `default` or `inline` layout. As the `uni-form` template
pack has been removed support for this has also been removed. This has resulted in the following **BREAKING** changes.
* The `form_style` attribute of `FormHelper` is removed.
* The `form_style` positional argument to `render_field()` is removed.
* The `form_style` positional argument to the `render()` method of all `LayoutObjects` is removed.
Audit for use of `render()` and `render_field()` due to the removal of the `form_style` positional argument is therefore
required. For example:
```
# django-crispy-forms 1.x
html = my_layout_object.render(form, form_style, context)
# django-crispy-forms 2.x
html = my_layout_object.render(form, context)
```
* Widespread use of the `|safe` in crispy-form templates is removed. Audit for html input in your forms
especially for Field and Prepended/Appended text. To retain the previous behaviour mark text as safe
in your project code using
[`mark_safe()`](https://docs.djangoproject.com/en/4.0/ref/utils/#django.utils.safestring.mark_safe). Refs #296.
# Other Changes
* Dropped support for Django 2.2.
* Added support for Django 4.1 and 4.2.
* Added support for Python 3.11.
* The `flat_attrs()` method of `FormActions` is removed. Attributes provided by `**kwargs` are now passed via the `flat_attrs` function during `__init__()` instead of with each call of `render()`
* The `html5_required` attribute of `FormHelper` is removed. In all supported versions of Django the `required` attribute is provided by the core `forms` module.
* The `FormActions` layout object learnt a `css_id` kwarg to add an `id` to the rendered `
`
* The default values of "form_error_title" and "formset_error_title" of FormHelper changed from `None` to `""`.
* An attribute error is now raised if the `CRISPY_TEMPLATE_PACK` setting is not provided.
* The `get_layout_objects()` and `get_field_names()` functions of `LayoutObject` now return a list of `Pointers` rather than a list
of lists. Pointers are a `dataclass` containing a list of `posistions` and the `name` of object/field.
## 1.14.0 (2022-01-22)
* Added support for Python 3.10
* Dropped support for Django 3.1
* Dropped support for Python 3.6
* Added bootstrap modal layout object (#1204)
* Added `input_size` argument to `FieldWithButtons` to allow customisation of the size of the input in the Bootstrap 4
template pack. (#1159)
See the [1.14.0 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/18?closed=1) for the full change list.
## 1.13.0 (2021-09-25)
* Added support for Django 4.0
## 1.12.0 (2021-06-11)
* Fixed rendering of grouped checkboxes and radio inputs in the Bootstrap 4 template pack. (#1155)
* Introduced new `input_size` argument to `AppendedText`, `PrependedText` and `PrependedAppendedText`. This allows
the size of these grouped inputs to be changed in the Bootstrap 4 template pack. (#1114)
* Confirmed support for Django 3.2
* Dropped support for Python 3.5
* Dropped support for Django 3.0
See the [1.12.0 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/16?closed=1) for the full change list.
## 1.11.2 (2021-03-16)
* Added HTML parsing tools to help testing of template packs (#1128)
* Fixed rendering of all widget attributes for file fields (#1130)
See the [1.11.2 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/15?closed=1) for the full change list.
## 1.11.1 (2021-02-21)
* Added `custom-select` for select widgets within prepended and appended fields (#1116)
See the [1.11.1 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/14?closed=1) for the full change list.
## 1.11.0 (2021-01-30)
* Implemeneted `custom-select` for Select widgets in the Bootstrap4 Template Pack (#1091)
* Fixed `data-parent` in AccodrianGroup (#1091)
* Documentation improvements
See the [1.11.0 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/13?closed=1) for the full change list
## 1.10.0 (2020-11-18)
* Fixed test causing `SystemCheckError` in some cases. (#1075)
* Radio and Checkbox now respect the field's `disabled` attribute when using the Bootstrap4 template pack. (#1057)
* A number of documentation improvements.
See the [1.10.0 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/12?closed=1) for the full change list
## 1.9.2 (2020-07-11)
* Fixed FileField UI bug
See the [1.9.2 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/11?closed=1) for the full change list.
## 1.9.1 (2020-05-16)
* Added Bootstrap 4 styling for clearable file widget.
* Fixed FileField UI bug.
* Project now uses GitHub actions for testing.
See the [1.9.1 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/10) for the full change list.
## 1.9.0 (2020-02-28)
* Removed support for Python 2.
* Removed support for Django versions prior to 2.2.
* CSS for Column layout object in Bootstrap 4 template pack changed to 'col-md'. Default is now over ridden when another 'col' class is added to css_class.
See the [1.9.0 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/9) for the full change list.
## 1.8.1 (2019-11-22)
* Fixing FileField UI bug introduced with 1.8.0
* Remove is-valid css class for radio (bug introduced with 1.8.0)
* Various alignment and margin fixes for Bootstrap 4 template pack
* Documentation : using read-the-docs template, documenting how to run test suite, documenting use_custom_control help attributes
See the [1.8.1 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/8?closed=1) for the full change list.
## 1.8.0 (2019-10-17)
* Updated compatibility for Django 1.11, 2.1, 2.2 and 3.0 in line with Django's
supported versions policy.
* Numerous improvements to the Bootstrap 4 template pack, which may now be
considered mature.
Here are some changes that might affect custom templating you already have in
place when using Bootstrap 4 :
* Using [Custom Forms for radio and checkbox](https://www.w3schools.com/bootstrap4/bootstrap_forms_custom.asp).
You may disable this by setting `FormHelper.use_custom_control = False`.
* Using [Bootstrap 4 `"form-row"` class in place of `"row"`](https://getbootstrap.com/docs/4.3/components/forms/#form-row).
* Fixing [layout hierarchy between input and its label for checkbox and radio](https://getbootstrap.com/docs/4.0/components/forms/#checkboxes-and-radios).
Links are to the relevant Bootstap 4 docs.
See the [1.8.0 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/7?closed=1) for the full change list.
Many thanks to all involved in bringing together a great release!
## 1.7.2 (2018-03-09)
* Bugfixes following v1.7.1
See [1.7.1 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/6?closed=1)
for full issue list.
## 1.7.1 (2018-03-05)
* Bootstrap 4 template pack.
See [1.7.1 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/5?closed=1)
for full issue list.
## 1.7.0 (2017-10-17)
* Fixes compatibility with Django 2.0
* Various other fixes.
See [1.7 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/4?closed=1)
for full issue list.
## 1.6.1 (2016-10-17)
* Updates compatibility for Django 1.10
* A number of small Bootstrap 4 fixes.
See [1.6.1 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/3?closed=1)
for full issue list.
## 1.6.0 (2016/1/7)
* Fixed compatibility with Django 1.9
* Dropped support for Django 1.7
* Added Bootstrap 4 template pack
* Other small fixes.
See [1.6.0 Milestone](https://github.com/maraujop/django-crispy-forms/issues?q=milestone%3A1.6.0+is%3Aclosed) for full issue list.
## 1.5.2 (2015/9/10)
* Fix: KeyError: u'wrapper_class' when clearing template context. #511, #512
* Fix: Alignment of stacked checkboxes and radio buttons in Bootstrap 3 #358
See [1.5.2 Milestone](https://github.com/maraujop/django-crispy-forms/issues?utf8=✓&q=milestone%3A1.5.2+) for full issue list.
## 1.5.1 (2015/8/21)
Special thanks in this release to Dmitry Dygalo @Stranger6667 for a marathon effort updating the
test suite and code base.
* Switched to py.test. Modernised test suite. Enabled tox, code coverage and Travis for all
supported Python/Django versions. [See list of Merged "Testing/Process" PRs here](https://github.com/maraujop/django-crispy-forms/pulls?q=is%3Apr+is%3Amerged+milestone%3A1.5.1+label%3ATesting%2FProcess)
* Added compatibility with Python 3.2
* Fix: Allow LayoutObject & BaseInputs to accept custom template #493
## 1.5.0 (2015/8/16)
Special thanks in this release for all the **supporters and donators**.
* Fixed compatibility with: Python 3, Django 1.7, Django 1.8 and Django 1.4.16. Merged PR #417, but thanks to PRs #369, #368 and #310. Closes also #383.
* Updated test suite for compatibility with all supported Django versions 1.4, 1.7, 1.8 and run CI against these and Django `master`. See #451, #455.
* Bug fix for specifying `template_pack` in `{% crispy %}` tag, `bootstrap3` couldn't be set that way.
* New doc section for creating custom template packs.
* Fixed Bootstrap3 checkbox alignment issues with label texts, see #275.
* First `AccordionGroup` can now be set to `active=False`, see #246.
* Fixed Bootstrap3 checkbox alignment issues for all device sizes, see #225 and #267.
* All forms are now rendered with {{ form.media }}, this makes forms containing widgets with `Media` meta class work, see #263.
* Adjusted `{% specialspaceless %}` to avoid breaking intended spaces and be less aggressive, see #250.
* Fixed inputs rendering for bootstrap3 and redo `FormActions` layout object bootstrap3 template for correct alignment, see #279.
* `MultiField` now obeys `form_show_labels`, see #278.
* Added `wrapper_class` to `bootstrap.InlineRadios`, see #272.
* Render label for checkboxes within `table_inline_formset.html`, see #262.
* Removed deprecated layout object `AppendedPrependedText`, replaced by `PrependedAppendedText`.
* Fixed `PrependedAppendedText` when rendering a select widget, in bootstrap and bootstrap3 template packs, see #258.
* Added support to `{% crispy_addon %}` tag for `form_show_labels`, see #256.
* Major cleanup and refactor of the template pack system thanks to @tepez, see #217 and #237:
- Template packs are now self contained/independent, removing dangerous cross references. If you have a custom template pack this can cause backwards incompatibility, but it will pay in the future to adjust to this changes.
- `MultiField` cannot be used with `bootstrap` or `bootstrap3` template packs.
- Added `template_pack` `FormHelper` attribute, so that template packs can be specified at form helper level. This changes layout objects `render` behavior.
* Default template pack is now `bootstrap3`.
* Make `CRISPY_TEMPLATE_PACK` setting optional, see #237 and #244.
## 1.4.0 (2013/9/1)
Special thanks in this release to **James Friedman @jamesmfriedman**, for his amazing support in PR #213, adding initial Bootstrap 3 support.
* Bootstrap 3 inline forms support and docs for inline forms with Bootstrap 3, see #233.
* `update_attributes` can now work with a field name, see docs.
* Adjusted unicode checkings for Python 3, see #231.
* Adjusted how bootstrap `Tab` layout object attributes are applied to make sense, see #228.
* Major refactor of testing suite architecture, breaking huge `tests.py` file into several and also splitting tests for different template packs into different tests cases, runners for template packs updated.
* Added support for horizontal forms in bootstrap3, see #209.
* Fixed spaces missing when rendering several submit inputs continued, see #211.
* Fixed checkboxes and radios for Bootstrap3, adjusted multiple inline radios and checkboxes, see #225.
* Update accordion markup for bootstrap3 compatibility, see #229.
* Moved `UneditableField` to bootstrap module, place where it should live, no backwards compatible import left behind.
* Added `bootstrap3` template pack thanks to James Friedman, see #213 and #209.
* `RadioSelect` and `CheckboxSelectMultiple` widget values and texts were being localized, when they shouldn't bee, see #214.
* If Django widget attrs where set for `RadioSelect` or `CheckboxSelectMultiple` they were not being rendered by crispy-forms, see #206.
* `form_show_labels` wasn't working correctly with some layout objects, see #193.
## 1.3.2 (2013/6/23)
* Labels were not being rendered with `|crispy` filter, see #202.
## 1.3.1 (2013/6/17)
* Fix default value for `form_show_labels` in case FormHelper doesn't define it, see #199.
* Added a backported version of `override_settings` for testing django 1.3.7 and adding it to Travis-ci matrix.
## 1.3.0 (2013/6/16)
Special thanks in this release to **Charlie Denton @meshy**, for his amazing support in PRs #189 and #190, long due.
* Deprecated `Tab` and `TabHolder` imports from `layout.py` module, they now live in `bootstrap.py` module.
* Removed Python 2.5 compatibility.
* Added `disable_csrf` helper attribute, see docs.
* Travis-ci support thanks to Charlie Denton, see #190.
* Python 3 compatibility thanks to Charlie Denton, see #189 and #190.
* Added a settings variable named `CRISPY_ALLOWED_TEMPLATE_PACKS` for adding easily support for new template packs, see #192.
* Added `{% crispy_addon %}` tag, see #195.
* Make `CRISPY_TEMPLATE_PACK` optional for tests
* Make tests run the same exactly way with `runtests.py` and `manage.py test`, see #183.
* Bug fix for `wrap_together` when using it with partial slices.
* Fixes for `KeepContext` context manager, see #180.
* Added `FormHelper.field_template` attribute, for easily override field template for a specific form/formset, see docs.
* Added a template for rendering formsets inline within tables named `bootstrap/table_inline_formset.html`, that can be easily used in conjunction with `FormHelper.template`.
* Added `FormHelper.template` attribute, that easily allows to override form/formset general structure template, see docs.
* Added `form_show_labels` helper attribute.
* Redoing filters to use `isinstance` instead of hacky internal name checking, this way subclasses of standard fields will work out of the box with crispy-forms, see #176.
## 1.2.8 (2013/5/10)
* Bug fix for `KeepContext` context manager, when crispy-forms used with Jingo/Jinja2 templates, see #179.
* Some formset tests were breaking in some Django versions. Also added a `make test` for easily running project tests, see #178.
## 1.2.7 (2013/5/6)
* Bug fix for model formsets and inline formsets, when being rendered with a `FormHelper` with a layout set, where some hidden formset management fields would be missing, breaking saving to database.
* Added `render_hidden_fields` attribute to `FormHelper`, see docs.
* Added `render_hidden_fields` attribute to `FormHelper`, see docs.
## 1.2.6 (2013/5/1)
* Fixes to `Container` and `TabHolder`, affecting class variable helpers with layouts containing `TabHolder` or `AccordionGroup` objects, see #172.
* Bug fix for `KeepContext` context manager, see #172.
## 1.2.5 (2013/4/25)
* Avoid raising Exceptions in `|as_crispy_field` filter when not in DEBUG mode.
* Popping `css_id` to avoid having a css-id attribute, see #167.
* Fixed a bug in dynamic layout API, when wrapping layout objects that had arguments passed after fields. Moving `LayoutSlice` to `layout_slice` module.
* Fixed test failing when tests runned from manage.py test.
* Fixed testing name conflict, see #130.
## 1.2.4 (2013/4/13)
* Added `wrapper_class` kwarg to `Field` layout object, see #163.
* Added `Accordion` and `AccordionGroup` bootstrap layout objects, see #162.
* Bug fix in `render_crispy_form` to avoid override existing context, see #153.
* Use formset iterator instead of `forms` list attribute, see #152.
* Don't display fieldset legend if empty, see #147 and #155.
* Bug fix for pickling crispy forms by powderflask, see #107.
* Switched from `django.form.utils.flatatt` to internal `flatatt` utils implementation, this allows adding data-attrs to `FormActions` and `StrictButton`.
* `render_field` now uses a context manager to avoid side effects when layout objects update template context. This makes context mutability safe within layout objects.
* Added `greedy` kwarg to `filter` dynamic API.
* Fixing error logging on `|as_crispy_field` filter, see #135.
* Implemented `__delitem__`, `__len__` and `__setitem__` in `LayoutObject` and `DynamicLayoutHandler`, this avoids pylint warnings, see #114.
* Docs folder no longer included when installing crispy-forms, see #132.
* Added `wrap_once`, `update_attributes`, `map` and `pre_map` to LayoutSlice.
## 1.2.3 (2012/12/4)
* Fixed imports to be relative to package, avoiding namespace collisions.
* Removed circular dependency between `layout` and `bootstrap`, see #129.
* Bug fix, adapted use of inspect module in `utils.py` to avoid breaking Python 2.5 compatibility.
## 1.2.2 (2012-11-30)
* Bug fix, reduction of white space in crispy-forms output could mess within tags, see #127, reverting part of this reduction.
* Renamed `AppendedPrependedText` to `PrependedAppendedText`.
* Moved `Tab` and `TabHolder` to `bootstrap.py`.
## 1.2.1 (2012-11-28)
* Bug fix `help_text_inline` set to True, see #117.
* New fix for the space between buttons problems, see #62.
* Reduced importantly whitespace in html generated by crispy-forms, forms are now more compact.
* Added support for specifying a template pack per form, see #66 and #109.
* Removed `clearfix` class from bootstrap templates, not necessary anymore, see #105.
* Space cleanup in bootstrap templates, thanks to Si Feng, see #122.
* Fixed `MultiField` to work with `form_show_errors` helper attribute.
* Fixed a bug in `MultiField` that set error class when there were form errors, no matter if the fields with errors were contained within, see #120.
* `FieldWithButtons` now supports `Field` layout object as its first parameter, for setting input attributes.
* Bug fixes for `FieldWithButtons`, field label, `help_text` or error messages were not being rendered, see #121.
* Fixed a bug that was making crispy-forms render extra fields with ModelForms that didn't have `Meta.fields` defined, thanks to Jean-Baptiste Juin for reporting it.
* Fixed a bug that was breaking Django 1.2 compatibility when copying context variables, thanks to Alex Yakovlev for submitting a patch, see #108.
* Fixed a bug for `AppendedText`, `PrependedText` and `AppendedPrependedText` layout objects, thanks to Bojan Mihelac, see #104.
* Fixed a bug in appended and prepended text layout objects for respecting hidden fields, thanks to Bojan Mihelac, see #103.
* Added two new bootstrap layout objects: `FieldWithButtons` and `StrictButton`.
* Added checks and better error messages for dynamic API.
* Fixed `get_layout_objects` recursive call for Python2.5 compatibility, thanks to Can Başçıl for reporting it.
## 1.2.0 (2012-9-24)
* Update prepended and appended templates to respect hidden fields, thanks to Bojan Mihelac, see #GH-103.
* Added `InlineCheckboxes` to bootstrap layout objects, for rendering checkboxes inline.
* `BaseInput` subclasses, like `Submit` can now have its value set to a context variable.
* Rendering inputs added with `add_input` in bootstrap using the right templates, see #GH-95.
* Improved formsets rendering docs thanks to Samuel Goldszmidt, see #GH-92.
* Added `Tab` and `TabHolder` layout objects thanks to david-e, see #GH-91.
* Fixed default bootstrap button default classes thanks to david-e, see #GH-90.
* Fixed some flaws in new testing structure by Markus Hametner.
* Added helper attribute `error_text_inline` thanks to Lee Semel for controlling how to render form errors, as a block or inline, see #GH-87.
* Support `ModelMultipleChoiceField` on `checkboxselectmultiple`, see #GH-86.
* Redoing testing structure a little bit, to run uni_form and bootstrap tests separately. They share most of the code base, but templates pack are separate and we need to care both have the same quality assurance.
* `AppendedText`, `PrependedText` and `AppendedPrependedText` were not respecting `form_show_errors` helper attribute, see #GH-77.
* Added a version string to the app under root __init__, see #GH-76.
* Added `html5_required` helper attribute for rendering required fields using HTML5 required attribute within the input, see #GH-72. Thanks to Lloyd Philbrook.
* Some docs typos and errors fixed, also a major upgrade to docs covering the new functionality.
* Adding a `utils.render_crispy_form` function, that renders a form the crispy way in Python code. This might be useful with AJAX, testing or text generation/manipulation, see #GH-64.
* Tiny cosmetic fix, that adds an space after a button, see #GH-62.
* `MultiField` and `Fieldset` layout objects can now have any kind of attribute defined, thanks to Lloyd Philbrook, see #GH-71.
* Making `Fieldset`, `MultiField` & `HTML` contents lazy translatable thanks to Rivo Laks, see #GH-69.
* Fixing `radioselect` checked status when used for a FK in a ModelForm, see #GH-68.
* Fixing `form.Meta` usage, using instance `fields` instead of static `Meta` definition, so that it works when updating forms on the go, see #GH-59.
* Added a low level manipulation API for layout and layout objects. Added a `LayoutObject` base class that creates an interface. This allows to access nested fields easily and use list methods without know internals of the system.
* Added a `|classes` filter that returns field's classes.
* Now `FormHelper` can accept a form instance as an optional first argument, from which it can build a default layout.
* Added an API for manipulating dynamic layouts and programmatic layout building.
* Added `UneditableField` bootstrap layout object for uneditable fields.
* Support for hiding fields using `Field('field_name', type="hidden")`, see #GH-55.
* Avoid template context pollution of variable `form` after using {% crispy %} tag, see #GH-54.
* Added an `attrs` helper attribute, for more flexible form attributes, see #GH-48.
* New `AppendedPrependedText` layout object thanks to Samuel Goldszmidt, see #GH-45.
* Removal of some whitespace in crispy form's HTML generated, see #GH-42.
* New `MultiWidgetField` layout object by Michal Kuffa, see #GH-39.
## 1.1.4 (2012-5-24)
* Multithread safety improvements for `BasicNode`.
* Security fix: Thread safety fixes to `CrispyFieldNode` thanks to Paul Oswald. This avoids leaking information between requests in multithreaded WSGI servers.
* Added css class `control-label` to `AppendedText` and `PrependedText` layout object's templates.
* `{% crispy field %}` tag can now pass attrs to `MultiWidget` subclasses by Michal Kuffa. `attrs` are set for sub-widgets. Also `attrs` can now be an iterable for passing different attributes to different sub-widgets. For example,this way MultiWidget's widgets get css classes set correctly.
* Turning underscores into hyphens for `Field` layout objects.
* Fix for `ChoiceFields` using non-string choices with radio buttons thanks to Rudy Mutter. See #GH-46, #GH-43 and #GH-35.
## 1.1.3 (2012-4-21)
* `|crispy` and `|as_crispy_field` filters were not rendering errors. Thanks to @ximi for reporting it and submitting a patch. See issue #GH-28.
* Fixing a test that was breaking when language was not English. Thanks to @gaftech, see #GH-30.
* Fixing `radioselect.html` and `checkboxselectmultiple.html` templates. Thanks to Christopher Petrilli for submitting a patch for `radioselect`. See issue #GH-35.
* HTML attributes can now be set in `BaseInput` subclasses like `Button` by @jamesmfriedman. See #GH-32.
* Fix for dynamic crispy-forms with Meta classes by Jeroen Vloothuis. See #GH-37.
* Labels now use `id_for_label` instead of `auto_id` to avoid ids breaking on multiwidgets. by Daniel Izquierdo. See #GH-38.
* Adding a flatatt custom function in `utils.py` for flatting extra HTML attributes.
* HTML attributes can now be set in `Div` layout object.
* Adding tests for new functionality and bugs.
## 1.1.2 (2012-2-29)
* input name attribute is no longer slugified if only one word is provided, respecting caps.
* Changes in bootstrap global error templates by David Bennett.
* Added class `control-label` to labels, for horizontal layout thanks to bitrut.
* Using `{{ field.html_name }}` instead of `{{ field.name }}` in field templates, so that they work with form prefixes (formwizard) by Patrick Toal.
* Fixing error rendering in bootstrap AppendedText and PrependedText.
* Applying `field.css_classes` in bootstrap `field.html` instead of widget classes.
* Fixes for bootstrap simple checkbox input to be wrapped correctly.
## 1.1.1 (2012-2-17)
* Fixing a critical bug in bootstrap templates, that was breaking `{% load crispy_forms_tags %}`
## 1.1.0
* Fixing produced html by a checkbox field, closing label the right way and rendering checkbox in the right place.
* Passing full context to field rendering, to be consistent and having access in `field.html` template to helper attributes.
* Custom helper attributes can now be set and will be part of templates context, this way you can define custom specific behavior.
* Adding @kennethlove bootstrap template pack into django-crispy-forms core.
* Adding `CRISPY_TEMPLATE_PACK` setting variable to easily switch between different template packs. Default template pack is now bootstrap.
* Upgrading bootstrap templates, fixing some bugs and redoing the hierarchy.
* Upgrading tests for multiple template packs.
* Renaming `UNIFORM_FAIL_SILENTLY` setting variable to `CRISPY_FAIL_SILENTLY`, upgrading migration instructions.
* Redoing bootstrap `field.html` template to render `radioselect` and `checkboxselectmultiple` Django widgets a la bootstrap.
* Adding a `render_unmentioned_fields` helper attribute, that renders all fields in a form, no matter what the layout is. Default is `False`.
* Adding a `|css_class` filter that renders field classes in an elegant way.
* Turning `|with_class` filter into `{% crispy_field %}` tag, so that parameters for rendering the field can be passed.
* Adding a `help_text_inline` helper attribute, that controls whether to render help texts in bootstrap with "help-inline" or "help-block".
* Adding a `flat_attrs` variable to the context passed to `field.html` to be able to do all kind of html attributes when rendering a field, using `Field` layout object.
* Adding a `template` kwarg to `Field` layout object that allows to override template used for rendering a field.
* Adding a `bootstrap.py` module that holds bootstrap specific layout objects, for higher bootstrap integration.
* Adding a `AppendedText`, `PrependedText` and `FormActions` bootstrap layout objects. First two based in polyvalent `Field` layout object.
## 1.0.0
* Using `baseinput.html` template within `whole_uni_form.html`, to be DRY and consistent.
* `BaseInput` subclasses like `Submit` can now have ids set, using `css_id`
* Adding a simplified alternative syntax for `{% uni_form %}` tag. We can now do `{% uni_form form %}` for rendering a form using a helper, instead of `{% uni_form form form.helper %}`, if the `FormHelper` attribute attached to the form is named `helper`.
* Improving `rendered_fields` checking performance.
* Layouts are now rendered strictly. We don't render fields missed in the layout. If the form has a Meta class with `fields` or `exclude`, then we follow Django standards.
* Added `Field` layout object. You can wrap name fields within and set all kind of attributes easily or override widget template.
* Fixed #GH-111 we were not rendering all the classes in `|with_class` filter
* Moving django-uni-form to django-crispy-forms. Renaming tags, filters and modules. Updating tests and so on. Adding migration instructions.
* More work on simpler and easier docs.
* Adding `form_show_errors` helper attribute, that controls whether to render or not `form.errors`
* Improving template hierarchy for more template code reusability.
# CHANGELOG for django-uni-form
## 0.9.0
You can read on how to use new features included in this version at:
http://tothinkornottothink.com/post/10398684502/django-uni-form-0-9-0-is-out-security-fix
* Fixed a bug in `|with_class` filter so that it supports `show_hidden_initial`, see #GH-95 to not break.
* Fixed a problem on Fieldset's legends internationalization. Thanks to Bojan Mihelac, see #GH-90.
* Fixed XSS bug thanks to Charlie Denton, see #GH-98. Errors cannot be rendered safe, because field's input can be part of the error message, that would mean XSS.
* Updating and improving docs, adding more use case examples.
* Split `helpers.py` file into `helper.py`, `layout.py` and `utils.py`. Added a deprecation warning.
* Improved testing coverage, specially for formsets and i18n.
* Improved rendering performance of `{% uni_form %}` tag and `|as_uni_form` filter avoiding reloading templates every time, see #GH-81.
* Added support for Django `Form.error_css_class` and `Form.required_css_class` custom CSS classes, see #GH-87.
* Moved template code in Layout objects into separate files in `uni_form/layout` directory. Layout objects templates can now be easily overridden, see #GH-37.
* `form_style` can now be used without having to set a helper Layout, see #GH-85.
* `form_action` is not lowered anymore and `form_action` is set to "" by default instead of "." thanks to Jianbo Guo, see #GH-84.
* `Multifield` field template `multifield.html` markup fixed, adding `help_text` support and removing `labelclass` from labels.
* Fixed testing suite, when run not using `DjangoTestSuiteRunner` provided, thanks to Narsil #GH-82.
* Removed test_project from the project.
* Improved `MultiField` performance avoiding instantiating BoundFields twice.
* Fixed a bug in `MultiField` that raised an exception when internal fields had errors, because of `self.css` not existing.
* Added an extra optional parameter to `render_field` called `layout_object`, used for storing in it a list of bound fields.
* Refactor all Layout objects to use templates and not having hardcoded HTML in the code, based on Jonas Obrist work. Resolves Issue #GH-37
* Added a Layout object called `Div`. `Row` and `Column` both inherit from `Div`
* `Layout` can now be a child of `Layout`, see issue #GH-76.
## 0.8.0
You can read on how to use new features included in this version at:
http://tothinkornottothink.com/post/7339670508/new-kung-fu-in-django-uni-form-0-8-0
* Elevated Miguel Araujo to project lead!
* Added a forloop simulator for formset forms rendering.
* `ButtonHolder` Layout object added for holding `HTML` and buttons: `Submit`, `Reset`, `Button`.
* Turned BaseInput inherited objects like: `Submit`, `Reset`, `Hidden` and `Button` into Layout objects.
* Fixed a bug with `rendered_fields` when no fields where in the Layout.
* `Fieldset` legends are now templates full context aware.
* Based on @issackelly's and @johnthedebs's work a template called `betterform` has been added for supporting @carljm's form-utils BetterForms.
* `FormHelper` method `get_attr` has been renamed to `get_attributes`
* `uni_form_tags` has been split into two different files: `uni_form_tags` and `uni_form_filters`.
* Removing i18n tags from the templates, as they are not necessary anymore.
* Removed all the internationalized hardcoded text, in favor of template variables: `form_error_title` and `formset_error_title`, both can be set as helper's attributes.
* `as_uni_errors` filter can now render formset's `non_form_errors` uni-form way.
* Moved `{% uni_form_setup %}` tag to use STATIC_URL instead of MEDIA_URL
* Added the possibility to specify a helper for formsets too.
* Renamed media directory to static, to be compatible with Django 1.3 staticfiles.
* Added a `form_style` FormHelper attribute for setting global style of a form: inline or default.
* Turning `HTML` into a full context aware django template field, having access to the whole context of the template in which the form is rendered.
* Turning `Layout` and `Fieldset` fields attributes into lists, so that they can be changed dynamically.
* Changing formHints from paragraphs to divs, so ul or ol can be placed within.
* Removing slugify filter from form ids, so they can be set as user's preferences.
* Added CSS class 'asteriskField' for asterisks. Added CSS class 'fieldRequired' for required input labels.
* `UNIFORM_FAIL_SILENTLY` variable setting has been added for making django-uni-form log errors and fail silently, based on Adam Cupiał's work.
* Several bug fixes in `MultiField`.
* Added unicode support for layout field names and improved error handling.
* Refactored testing system and raised testing coverage.
* Clean part of the code base and comments. All old CSRF code for supporting old versions of Django has been removed.
* Refactored BasicNode for better readability and reducing lines of code.
* Added formsets support based on Victor Nagy's (nagyv) and Antti Kaihola's (akahiola) work.
* Bug fix in `{% uni_form %}` tag that didn't work without a helper and it was meant to be optional.
* CSS classes can be set in Submit buttons.
* Thanks to J. Javier Maestro (jjmaestro) now we can set ids and classes for `Fieldset`, `MultiField`, `Row` and `Column`.
* Thanks to Richard Marko (sorki) changed CSS class of PasswordInput widget.
* Removing `Toggle` class as it wasn't being used anywhere.
* Moved `BaseInput` to helpers and removed `util.py` file.
* Removed `{% uni_form_jquery %}` tag
* Removed `namify` function from tags, as It wasn't being used anywhere.
* Improved internal documentation
* form methods generated by FormHelper are in lowercase (http://github.com/pydanny/django-uni-form/issues#issue/20)
* Thanks to Nagy Viktor added form_tag attribute to FormHelper. Now you can use the uni_form tag without the leading and trailing form tags.
* Thanks for Alison Rowland for giving django-uni-form sphinx docs
* Incorporated uni-form 1.4 by Dragan Babic
* Provide better adherence to uni-form specification of error messages
* mirumee provided some great work for making FormHelper more subclassable.
* django-uni-form 0.8 and higher lays out the HTML for the uni_form tag differently. The errorMsg div is now outside the fieldset as it should be.
* Thanks to Casper S. Jensen django-uni-form now supports 1.2 style csrf_token.
* csrf_token does not break earlier versions of Django. This will change when no version of django does not support csrf_token.
* Thanks to j0hnsmith changed {{ error }} to {{ error|safe }} so that html (eg links) can be added to error messages.
* Thanks to j0hnsmith changed {{ field.label }} to {{ field.label|safe }} so that html (eg links) can be added to field labels
* Kudos to Stepan Rakhimov fixed an admin datetime issue.
* Thanks to patrys (Patryk Zawadzki) FormHelper class is now easily subclass-able.
* Sorki (Richard Marko) made it so things work better in direct_to_template.
## 0.7.0
* Removed a from the layout module.
* Changed templatetags/uni_form.py to templatetags/uni_form_tags.py. Yes, this breaks backwards compatibility but fixes a namespace problems in Django with naming a templatetag library after the parent application.
* Changed form_action attribute to accept not just named URLs but also any old URL.
* Added in uni_form_setup tag.
* Added tests
* Added several new contributors including Dragan Babic
* Added Danish language translation
django-crispy-forms-django-crispy-forms-92b7260/CONTRIBUTORS.txt 0000664 0000000 0000000 00000005173 14512727554 0024277 0 ustar 00root root 0000000 0000000 ============
Contributors
============
django-crispy-forms Project Maintainers
=======================================
* Miguel Araujo
* Carlton Gibson
django-uni-form Project Founder
===============================
* Daniel Greenfeld
Contributors
============
* Alison Rowland
* Bojan Mihelac
* bjunix
* Casper S. Jensen
* Chris Adams
* Eddy Mulyono
* j0hnsmith
* James Pic
* James Tauber
* Karl Bowden
* Marcin Grzybowski
* Michael Lind Mortensen
* mirumee
* mvaerle
* Nagy Viktor
* Patrick Lauber
* Patryk Zawadzki
* Skylar Saveland
* Stepan Rakhimov
* John Maxwell
* Richard Marko
* Victor Nagy
* Antti Kaihola
* J. Javier Maestro
* Issac Kelly
* John Debs
* Adam Cupiał
* Nicolas Patry
* Jonas Obrist
* Charlie Denton
* Jason Culverhouse
* James Turnbull
* Patrick Toal
* David Bennett
* bitrut
* ximi
* Christopher Petrilli
* James Friedman
* Jeroen Vloothuis
* Daniel Izquierdo
* gaftech
* Michal Kuffa
* Paul Oswald
* Rudy Mutter
* Samuel Goldszmidt
* Andrei Antoukh
*
* Rivo Laks
* Lloyd Philbrook
* Piet Delport
*
* Markus Hametner
* Thomas Grainger
* Lee Semel
*
* Alex Yakovlev
* Si Feng
* Igor Katson
* Ben Delevingne
*
* Evan Borgstrom
* Daniel Shapiro
*
* Stefan "hr" Berder (白峰)
* Suleyman Melikoglu
* Vladislav Mitov
* Nemesis Fixx
* Chris Vigelius
* David Cramer
* Stas Rudakou
* Tom Yam
* Svyatoslav Bulbakha
* Andres Vargas
* Gabe Jackson
* Camilo Nova
*
* Daniel Mascarenhas
* Paras Kuhad
* Kevin Trad
* Steven Klass
* David Fischer
* Stefan Tjarks
* Jan Dittberner
* Michael Nielsen
* Stephen Mitchell
*
* Christopher Adams
* John Comeau
* Yoong Kang Lim
* Dmitry Dygalo
* Lee Skillen
* Bryan Brancotte
* David Smith
django-crispy-forms-django-crispy-forms-92b7260/LICENSE.txt 0000664 0000000 0000000 00000002110 14512727554 0023410 0 ustar 00root root 0000000 0000000 Copyright (c) 2009-2021 Miguel Araujo, Daniel Feldroy and contributors.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
django-crispy-forms-django-crispy-forms-92b7260/MANIFEST.in 0000664 0000000 0000000 00000000356 14512727554 0023335 0 ustar 00root root 0000000 0000000 include MANIFEST.in
include README.rst
include *.md
include *.txt
include *.yaml
include Makefile
include tox.ini
include .editorconfig
graft crispy_forms
graft docs
graft tests
graft requirements
prune docs/_build
global-exclude *.pyc
django-crispy-forms-django-crispy-forms-92b7260/Makefile 0000664 0000000 0000000 00000000263 14512727554 0023234 0 ustar 00root root 0000000 0000000 .PHONY: develop test
develop:
pip install -q -r requirements.txt
pip install -q -e .
test: develop
DJANGO_SETTINGS_MODULE=tests.test_settings py.test tests --cov=crispy_forms django-crispy-forms-django-crispy-forms-92b7260/README.rst 0000664 0000000 0000000 00000007044 14512727554 0023267 0 ustar 00root root 0000000 0000000 ===================
django-crispy-forms
===================
.. image:: https://github.com/django-crispy-forms/django-crispy-forms/actions/workflows/main.yml/badge.svg
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
.. image:: http://codecov.io/github/django-crispy-forms/django-crispy-forms/coverage.svg?branch=main
:target: http://codecov.io/github/django-crispy-forms/django-crispy-forms?branch=main
The best way to have Django_ DRY forms. Build programmatic reusable layouts out of components, having full control of the rendered HTML without writing HTML in templates. All this without breaking the standard way of doing things in Django, so it plays nice with any other form application.
`django-crispy-forms` supports Django 4.2+ with Python 3.8+.
Looking for Bootstrap 5 support? See the `crispy-bootstrap5 package`_.
.. _`crispy-bootstrap5 package`: https://github.com/django-crispy-forms/crispy-bootstrap5
The application mainly provides:
* A filter named ``|crispy`` that will render elegant div based forms. Think of it as the built-in methods: ``as_table``, ``as_ul`` and ``as_p``. You cannot tune up the output, but it is easy to start using it.
* A tag named ``{% crispy %}`` that will render a form based on your configuration and specific layout setup. This gives you amazing power without much hassle, helping you save tons of time.
Django-crispy-forms supports several frontend frameworks, such as Twitter `Bootstrap`_ (versions 2, 3, and 4), `tailwind`_, `Bulma`_ and Foundation. You can also easily adapt your custom company's one, creating your own, `see the docs`_ for more information. You can easily switch among them using ``CRISPY_TEMPLATE_PACK`` setting variable.
.. _`tailwind`: https://github.com/django-crispy-forms/crispy-tailwind
.. _`Bootstrap`: https://getbootstrap.com
.. _`Bulma`: https://github.com/ckrybus/crispy-bulma
.. _`see the docs`: https://django-crispy-forms.readthedocs.io
Authors
=======
django-crispy-forms is the new django-uni-form. django-uni-form was an application created by `Daniel Greenfeld`_ that I led since version 0.8.0. The name change tries to better explain the purpose of the application, which changed in a significant way since its birth.
If you are upgrading from django-uni-form, we have `instructions`_ for helping you.
* Lead developer: `Miguel Araujo`_
.. _`Daniel Greenfeld`: https://github.com/pydanny
.. _`Miguel Araujo`: https://github.com/maraujop
.. _`instructions`: https://django-crispy-forms.readthedocs.io/en/latest/install.html#moving-from-django-uni-form-to-django-crispy-forms
Example
=======
This is a teaser of what you can do with latest django-crispy-forms. `Find here the gist`_ for generating this form:
.. image:: http://i.imgur.com/LSREg.png
.. _`Find here the gist`: https://gist.github.com/1838193
Documentation
=============
For extensive documentation see the ``docs`` folder or `read it on readthedocs`_
.. _`read it on readthedocs`: https://django-crispy-forms.readthedocs.io/en/latest/index.html
Special thanks
==============
* To Daniel Feldroy (`@pydanny`_) for his support, time and the opportunity given to me to do this.
* The name of the project was suggested by the fantastic Audrey Feldroy (`@audreyfeldroy`_)
* To Kenneth Love (`@kennethlove`_) for creating django-uni-form-contrib from which bootstrap template pack was started.
.. _`@audreyfeldroy`: https://github.com/audreyfeldroy
.. _`@pydanny`: https://github.com/pydanny
.. _`@kennethlove`: https://github.com/kennethlove
.. _Django: http://djangoproject.com
django-crispy-forms-django-crispy-forms-92b7260/crispy_forms/ 0000775 0000000 0000000 00000000000 14512727554 0024312 5 ustar 00root root 0000000 0000000 django-crispy-forms-django-crispy-forms-92b7260/crispy_forms/LICENSE 0000664 0000000 0000000 00000002065 14512727554 0025322 0 ustar 00root root 0000000 0000000 Copyright (c) 2009 Daniel Greenfeld and contributors.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. django-crispy-forms-django-crispy-forms-92b7260/crispy_forms/__init__.py 0000664 0000000 0000000 00000000024 14512727554 0026417 0 ustar 00root root 0000000 0000000 __version__ = "2.1"
django-crispy-forms-django-crispy-forms-92b7260/crispy_forms/base.py 0000664 0000000 0000000 00000001350 14512727554 0025575 0 ustar 00root root 0000000 0000000 class KeepContext:
"""
Context manager that receives a `django.template.Context` instance and a list of keys
Once the context manager is exited, it removes `keys` from the context, to avoid
side effects in later layout objects that may use the same context variables.
Layout objects should use `extra_context` to introduce context variables, never
touch context object themselves, that could introduce side effects.
"""
def __init__(self, context, keys):
self.context = context
self.keys = keys
def __enter__(self):
pass
def __exit__(self, type, value, traceback):
for key in list(self.keys):
if key in self.context:
del self.context[key]
django-crispy-forms-django-crispy-forms-92b7260/crispy_forms/bootstrap.py 0000664 0000000 0000000 00000112012 14512727554 0026676 0 ustar 00root root 0000000 0000000 from random import randint
from django.template import Template
from django.template.loader import render_to_string
from django.utils.safestring import SafeString
from django.utils.text import slugify
from .layout import Div, Field, LayoutObject, TemplateNameMixin
from .utils import TEMPLATE_PACK, flatatt, render_field
class PrependedAppendedText(Field):
"""
Layout object for rendering a field with prepended and appended text.
Attributes
----------
template : str
The default template which this Layout Object will be rendered
with.
attrs : dict
Attributes to be applied to the field. These are converted into html
attributes. e.g. ``data_id: 'test'`` in the attrs dict will become
``data-id='test'`` on the field's ````.
Parameters
----------
field : str
The name of the field to be rendered.
prepended_text : str, optional
The prepended text, can be HTML like, by default None
appended_text : str, optional
The appended text, can be HTML like, by default None
input_size : str, optional
For Bootstrap4+ additional classes to customise the input-group size
e.g. ``input-group-sm``. By default None
active : bool
For Bootstrap3, a boolean to render the text active. By default
``False``.
css_class : str, optional
CSS classes to be applied to the field. These are added to any classes
included in the ``attrs`` dict. By default ``None``.
wrapper_class: str, optional
CSS classes to be used when rendering the Field. This class is usually
applied to the ``