Skip to main content

django-easy-formset

Django Formsets with ECMAScript 6

Python tests Upload Python Package

Installation

Installation is easy using pip and the only requirement is a recent version of Django.

python -m pip install django-easy-formset

Basic app configuration

Then to add the Django Easy Formset to your project add the app easy_formset to your INSTALLED_APPS.

INSTALLED_APPS = [
    # ...
    "easy_formset",
]

How to use

Video

Video

In template

{% load static %}
<head>
  <link rel="stylesheet" href="{% static 'easy_formset/easy_formset.css' %}">
</head>
<body>
  <div id="{{ formset.prefix }}">
    {{ formset.management_form }}

    <template formset-empty-form="{{ formset.prefix }}">
      {{ formset.empty_form.as_p }}
      <a formset-form-delete="{{ formset.empty_form.prefix }}>Delete</a>
    </template>

    <div formset-forms="{{ formset.prefix }}">
      {% for form in formset.forms %}
        <div formset-form>
          {{ form.as_p }}
          <a formset-form-delete="{{ form.prefix }}>Delete</a>
        </div>
      {% endfor %}
    </div>
    <button formset-add="{{ formset.prefix }}">Add Formset</button>
  </div>
  ...
  <script src="{% static 'easy_formset/easy_formset.js' %}"></script>
  <script>
    const formset = new Formset("{{ formset.prefix }}")
  </script>
</body>

Custom undo element

// add one root element...
Formset.revertHTML = '<a href="#">Custom undo link...</a>'

const formset = new Formset("{{ formset.prefix }}")

Handle add/deleted events

document.addEventListener('formset:add', (event) => {
  // access the form with event.detail.form
})

document.addEventListener('formset:deleted', (event) => {
  // access the form with event.detail.form
})

Nested formsets

See examples in tests.testapp.

Run tests

python -m pip -r requirements.txt
pytest

Run project test

python manage.py runserver

Metadata

Release files for django-easy-formset 0.2.4

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-easy-formset 0.2.4
File Size Uploaded Provenance Actions
django-easy-formset-0.2.4.tar.gz 5.2 kB Without provenance Details for django-easy-formset-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-easy-formset 0.2.4
File Interpreter ABI Platform Actions
django_easy_formset-0.2.4-py3-none-any.whl Python 3 none any Details for django_easy_formset-0.2.4-py3-none-any.whl

Total release size: 10.9 kB

Release files / django-easy-formset-0.2.4.tar.gz

Download URL django-easy-formset-0.2.4.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c2a0f598f33834e528f66c9b5eac935160619eb20da4303b5cfe7164c692089f
BLAKE2b-256 checksum
How to use checksums
a5554d821a9328471643e0d4b2062441eb2fe5b7f878fbadf3425679640cd3fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

Release files / django_easy_formset-0.2.4-py3-none-any.whl

Download URL django_easy_formset-0.2.4-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2334b0edba346aa7656055165d2b3a2540d6e4bda5ab601b9b110c480bfd375
BLAKE2b-256 checksum
How to use checksums
c7477afd9187cf4f75a39b40d959052451c433f0c868564955fbee005714d034
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

Security for django-easy-formset 0.2.4

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.

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