Skip to main content

A lightweight plugin for managing Django formsets with jQuery.

Project description

# django-dynamic-formsets

A lightweight plugin for managing Django formsets with jQuery.


## About this plugin

This [jQuery](http://jquery.com/) plugin helps you create more usable [Django](http://www.djangoproject.com/) formsets by allowing clients to add and remove forms on the client-side.

It was primarily developed by [Stanislaus Madueke](https://github.com/elo80ka), and re-packaged as a static Django app (with a couple shiny new enhancements and more docs) by [The Dallas Morning News](https://github.com/DallasMorningNews/).

This version of this plugin (like its predecessor) is available under the [BSD License]().

****


## Getting started

1. Download this repo or install from PyPI:

```bash
pip install django-dynamic-formsets
```

2. Then add `dynamic_formsets` to your `INSTALLED_APPS` setting and run `python manage.py collectstatic`.

3. You can now make your formsets dynamic by adding the following lines to a template:

```Django
{% load static %}

...

{% comment %}
(Your templated DOM here, possibly something like this:)
{% endcomment %}

<form id="my-form" method="post" action="">
{% csrf_token %}
{{ formset.media }}
{% for form in formset %}
<div class="individual-form">
{{ form.as_p }}
</div>
{% endfor %}
</form>

...

<script src="{% static "dynamic_formsets/jquery.formset.js" %}" type="text/javascript"> </script>

<script type="text/javascript">
$('.individual-form').formset();
</script>
```

****


## Configuration

Once you've followed steps 1 to 3 above, you're ready to customize the formset-handling javascript that's now on your page.

Detailed information about all the settings you can change in the javascript will be added to this repo very soon.

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-dynamic-formsets-0.0.7.tar.gz (11.2 kB view details)

Uploaded Source

File details

Details for the file django-dynamic-formsets-0.0.7.tar.gz.

File metadata

File hashes

Hashes for django-dynamic-formsets-0.0.7.tar.gz
Algorithm Hash digest
SHA256 452baa1dbd630c11c785ae0ad0444022d647834b10a747e0fa89e8b2b4773a05
MD5 f6923bf278f199612cceef9a2f242e38
BLAKE2b-256 8390c076563ec68ace1bbf90f1a1d5f1429428d940826b834689b6b5394fa24d

See more details on using hashes here.

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