Skip to main content

Django Formsets with ECMAScript 6.

Project description

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 %}
...
<div id="{{ formset.prefix }}">
  {{ formset.management_form }}

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

  <div formset-forms>
    {% for form in formset.forms %}
      <div formset-form>
        {{ form.as_p }}
        <a formset-form-delete>Delete</a>
      </div>
    {% endfor %}
  </div>

  <button formset-add>Add Formset</button>
</div>

<script src="{% static 'easy_formset/easy_formset.js' %}"></script>
<script>
  const formset = new Formset("{{ formset.prefix }}")
</script>
...

Custom revert element

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

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

Run tests

python -m pip -r requirements.txt
pytest

Run project test

python manage.py runserver

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-easy-formset-0.1.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

django_easy_formset-0.1.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file django-easy-formset-0.1.2.tar.gz.

File metadata

  • Download URL: django-easy-formset-0.1.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for django-easy-formset-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8887a6a00fc3b59b4a47e9adc993eb7ec1e743e572455c417e49a5a8f87775f3
MD5 c040ba626635178f2803d147c29667c3
BLAKE2b-256 4c491b3fb2a98f062a6c1367d81ee05d5efae661dc4360defbe20de1bc28c405

See more details on using hashes here.

File details

Details for the file django_easy_formset-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: django_easy_formset-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for django_easy_formset-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0869e65e2ec142af4ebf665c91fda19c24ab48e19f0de4af1ba1b616e4b2e258
MD5 b0e912927d7b2446bd5cc69a11e84737
BLAKE2b-256 acce40456064e80a4493987087701ba504a74efb50af730514ad022b0acc450e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page