Skip to main content
# Formit

[![Build Status](https://img.shields.io/travis/dinoperovic/django-formit.svg)](https://travis-ci.org/dinoperovic/django-formit)
[![Codecov](https://img.shields.io/codecov/c/github/dinoperovic/django-formit.svg)](http://codecov.io/github/dinoperovic/django-formit)
[![PyPI version](https://img.shields.io/pypi/v/django-formit.svg)](https://pypi.python.org/pypi/django-formit)

**Smiple [Django] form formating.**

Formit provides a template tag library for django to ease the formating of forms.

---

## Requirements

* [Django] 1.11, 1.10
* [django-classy-tags] for managing template tags.

## Installation

Install using *pip*:

```bash
pip install django-formit
```

Then add `formit` to `INSTALLED_APPS`.

## Usage

To use **Formit** add your templates:

```django
{% load formit_tags %}

{# To render the form pass in the string path or form instance. #}
{% form 'contact.forms.ContactForm' action="/" method="get" button="Send" %}

{# To render the form with custom contents. #}
{% form_block instance %}
<h3>Contact form</h3>
{% fieldset %}
{% endform_block %}

{# To render a custom form without any formating. #}
{% form_block instance blank=True %}
{% csrf_token %}
<h3>Contact form</h3>
<div class="column">
{% fieldset fields=form.visible_fields|slice:":3" %}
</div>
<div class="column">
{% fieldset fields=form.visible_fields|slice:"3:" %}
</div>
{% fieldset fields=form.hidden_fields %}
<button>Send</button>
{% endform_block %}

{# You can separate the rendering of visible and hidden fields. #}
{% fieldset visible_fields=instance.visible_fields hidden_fields=instance.hidden_fields %}
{# or to automatically extract them from a form. #}
{% fieldset form=instance %}

{# To render a single field #}
{% field instance.visible_fields.0 placeholder="Enter your name" %}
```

Fieldset tags can also be used without any arguments. In that case ``form`` from the context will be used,
which is automatically available inside the ``form`` or ``form_block`` tag.

## Templates

Templates available to override in ``templates/formit/*``:

* ``form.html``
* ``fieldset.html``
* ``field.html``

You can specify custom templates for each field widget by adding a template with lowercase class name of the widget.
For example ``formit/fields/textinput.html`` will render a `TextInput` widget.


[Django]: https://www.djangoproject.com/
[django-classy-tags]: https://github.com/ojii/django-classy-tags

Metadata

Release files for django-formit 0.1.3

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

Source distribution (sdist)

Source distribution for django-formit 0.1.3
File Size Uploaded
django-formit-0.1.3.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-formit 0.1.3
File Interpreter ABI Platform
django_formit-0.1.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 16.0 kB

Release files / django-formit-0.1.3.tar.gz

Download URL django-formit-0.1.3.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6cf054cf329f2b4ae78fa91ab80fe7a11b45125490b91cd049eac4044d761c9f
BLAKE2b-256 checksum
How to use checksums
13d1b4d864a4b5dbb6a5848bbee72f822a677c175069e17891840dc8cf077e5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_formit-0.1.3-py2.py3-none-any.whl

Download URL django_formit-0.1.3-py2.py3-none-any.whl
Size 9.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
37202ee380a2d9daebacd8550cc4408d36d516e3db6af4055bb878fd0452783f
BLAKE2b-256 checksum
How to use checksums
6b0ff833781479f8929bf35a064bb13c93300801930e743b4c356c105446487d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1.0

2 release files

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