Coder Social home page Coder Social logo

nitr0man / django-dynamic-formsets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dallasmorningnews/django-dynamic-formsets

0.0 1.0 0.0 235 KB

A jQuery plugin that allows you dynamically add new forms to a rendered django formset.

License: BSD 3-Clause "New" or "Revised" License

JavaScript 89.91% Python 10.09%

django-dynamic-formsets's Introduction

django-dynamic-formsets

A lightweight plugin for managing Django formsets with jQuery.

About this plugin

This jQuery plugin helps you create more usable Django formsets by allowing clients to add and remove forms on the client-side.

It was primarily developed by Stanislaus Madueke, and re-packaged as a static Django app (with a couple shiny new enhancements and more docs) by The Dallas Morning News.

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
```
  1. Then add dynamic_formsets to your INSTALLED_APPS setting and run python manage.py collectstatic.

  2. 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 }}
    <div class="formset">
        {% for form in formset %}
            <div class="individual-form">
                {{ form.as_p }}
            </div>
        {% endfor %}
    </div>
</form>

...

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

<script type="text/javascript">
    $('.formset').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.

django-dynamic-formsets's People

Contributors

adnathanail avatar allanjamesvestal avatar amfarrell avatar arhoads avatar elo80ka avatar flanaman avatar funsim avatar greut avatar lemuelf avatar luizanao avatar nitr0man avatar olliecook avatar philippemilink avatar prateem avatar saex avatar stefgmz avatar tisoo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.