django-dynamicinputs

Model and form fields to store values of multiple fields in dictionary


License
Unlicense
Install
pip install django-dynamicinputs==2.2.2

Documentation

Form field with variable list of rows

Requires Django framework and jQuery javascript library.

Installation

pip install dynamicinputs

Usage

Add "dynamicinputs" to installed apps in django settings file:

INSTALLED_APPS = (
    ...
    'dynamicinputs',
    ...
)

Then it can be used in model:

from dynamicinputs import DynamicInputField

parent_names = DynamicInputField(
        fields.CharField(
            label="Names and addresses of parent companies",
            widget=widgets.Textarea(),
            help_text="If your publishing company has no parent companies then enter 'none'"),
        max_count=10,
        button='Add company')
    )

Include required css and js files into your template:

{% load static %}

<link href="{% static 'dynamicinputs/dynamicinputs.css' %}" rel="stylesheet"/>
<script type="text/javascript" src="{% static 'dynamicinputs/dynamicinputs.js' %}"></script>