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

{% 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>
...

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.1.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

django_easy_formset-0.1.1-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

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