Skip to main content
=============================
crispy-templates
=============================

.. image:: https://badge.fury.io/py/crispy-templates.png
:target: https://badge.fury.io/py/crispy-templates

A collection of useful templates for customizing crispy forms layouts.

Documentation
-------------

The full documentation is at https://crispy-templates.readthedocs.io.

Quickstart
----------

crispy-templates depends on [crispy-forms](https://github.com/django-crispy-forms/django-crispy-forms#django-crispy-forms), make sure that you have properly installed crispy forms first.

Install crispy-templates::

pip install crispy-templates

Add it to your `INSTALLED_APPS`:

.. code-block:: python

INSTALLED_APPS = (
...
'crispy_templates.apps.CrispyTemplatesConfig',
...
)

Define your layout template in the `crispy_forms.helper.FormHelper` object:

.. code-block:: python
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Field, Layout

class BookForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(BookForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.template_pack = "bootstrap3"
self.helper.layout = Layout(
Field('publication_status', template="crispy_templates/layouts/radio_btngroup_field.html"),
)

Add the javascript by running `python manage.py collectstatic` and then including it in your template:

.. code-block:: python

{% static 'crispy_templates/js/crispy_templates.js' %}

Preferably add it to the footer of your page so as to not delay the page load.
**Note** - Currently only supports the `bootstrap3` template pack that comes with `crispy_forms`.

Credits
-------

Tools used in rendering this package:

* Cookiecutter_
* `cookiecutter-djangopackage`_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage




History
-------

0.2.0 (2017-01-17)
++++++++++++++++++

* Fixed method of rendering field so form would pull out the data
* Refactored how the project templates were structured and how to include the new template override
* Updated documentation

0.1.0 (2017-01-14)
++++++++++++++++++

* First release on PyPI.

Release files for crispy-templates 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crispy-templates 0.2.0
File Size Uploaded
crispy-templates-0.2.0.tar.gz 6.0 kB Details

Release files / crispy-templates-0.2.0.tar.gz

Download URL crispy-templates-0.2.0.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0a95cd84e8e91d8c8f7ba7600578caf6e3f28df3d800860524b0fd191085822c
BLAKE2b-256 checksum
How to use checksums
f94afe746465e06b31c451f5628be23167c9904fa1b706688c60097d7b4b04f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page