资源说明:forms/survey generator for dynamically constructor multi-page surveys that have the ability to be non-linear
# Formly [![](https://img.shields.io/pypi/v/formly.svg)](https://pypi.python.org/pypi/formly/) [![CircleCi](https://img.shields.io/circleci/project/github/eldarion/formly.svg)](https://circleci.com/gh/eldarion/formly) [![Codecov](https://img.shields.io/codecov/c/github/eldarion/formly.svg)](https://codecov.io/gh/eldarion/formly) [![](https://img.shields.io/github/contributors/eldarion/formly.svg)](https://github.com/eldarion/formly/graphs/contributors) [![](https://img.shields.io/github/issues-pr/eldarion/formly.svg)](https://github.com/eldarion/formly/pulls) [![](https://img.shields.io/github/issues-pr-closed/eldarion/formly.svg)](https://github.com/eldarion/formly/pulls?q=is%3Apr+is%3Aclosed) [![](https://img.shields.io/badge/license-BSD-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) ## Table of Contents * [Overview](#overview) * [Supported Django and Python versions](#supported-django-and-python-versions) * [Documentation](#documentation) * [Installation](#installation) * [Optional Requirements](#optional-requirements) * [Usage](#usage) * [Fields](#fields) * [Templates](#templates) * [Authorization](#authorization) * [Callbacks](#callbacks) * [Change Log](#change-log) * [License](#license) ## formly ### Overview ``formly`` is a forms/survey generator for dynamically constructed multi-page surveys with the ability to be non-linear. `formly` is an app that provides an out of the box solution to building adhoc forms to collect data from end users. It is multi-faceted in that it provides interfaces for building multi-page forms, interfaces for executing the survey, as well as views for reviewing results. Also, it is non-linear, meaning that you can route users taking the survey to different pages based on what they answered on certain questions. This allows you to create very rich surveys that dive deep on detail you care about while not wasting the time of users who would otherwise have to go through questions that do not apply to them. Development sponsored by [Midwest Communications](http://mwcradio.com/) and [Massachusetts General Hospital](http://www.massgeneral.org/). #### Supported Django and Python versions Django \ Python | 3.6 --------------- | ---- 2.2 | * 3.1 | * ## Documentation ### Installation To install formly: ```shell $ pip install formly ``` Add `formly` to your ``INSTALLED_APPS`` setting: ```python INSTALLED_APPS = [ # other apps "formly", ] ``` Next, add `formly.urls` to your project urlpatterns: ```python urlpatterns = [ # other urls url(r"^surveys/", include("formly.urls", namespace="formly")), ] ``` Finally, if you want to use formly's permission authentications, add `formly.auth_backend.AuthenticationBackend` to your settings AUTHENTICATION_BACKENDS: ```python AUTHENTICATION_BACKENDS = [ # other authentication backends "formly.auth_backend.AuthenticationBackend", ] ``` ### Optional Requirements In order to use built-in templates, add the following dependencies to your project: * pinax-theme-bootstrap (not required if you use different block names) * django-bootstrap-form (required for form rendering in templates) ```python INSTALLED_APPS = [ # other apps "bootstrapform", ] ``` ### Usage `formly` is designed to be plug-and-play, in that after you install `formly` using it should be as simple as creating and publishing surveys through the web interface. After installation, browse to wherever you mounted the urls for `formly` and you'll see an interface to be able to create a new survey. From here you can create a survey and begin editing pages. Pages in `formly` represent each step of the survey. The user will be guided through each page of the survey in the appropriate order saving each page at a time. For each page, you can give a title and add as many fields as you desire. If the field is a type that requires choices, then you will have the option on the fields detail/edit form to add choices. An optional value that can be supplied for a choice answer is the page to redirect the user to if they select that answer. If you have multiple choice fields in a single page with conflicting page routing, `formly` resolves to the first page it encounters. For example, if you had a question that had choice B route to page 3 and another question later in the form that had choice C route to page 5 and the user answered both questions with choice B and choice C, the user would go to page 3 next. Keep this in mind when building surveys. ### Fields `formly` enables you to create questions with a multitude of field types that will control the dynamic rendering and processing of form input on each page of your survey. All field types tie directly to a specific `field` and `widget` configuration as found in `django.forms`. The other attributes that can be passed into every field, `label`, `help_text`, and `required` can be set and managed at design time. For the field types that accept choices, there is the ability to set key/value pairs for each field that are used to populate the choices attribute for the field to be used for both display as well as form validation upon execution. #### Boolean (True/False) Renders and processes input using `django.forms.BooleanField`. #### Checkbox (Multiple Choice, Multiple Answers) A field generated from a `django.forms.MultipleChoiceField` with a `django.forms.CheckboxInput` widget, populated with choices specified at design time. This field allows for multiple selections. #### Date Provides a way to constrain input to dates only. It is generated from a `django.forms.DateField`. #### Likert Scale A `django.forms.ChoiceField` populated with choices specified at design time. The field template `formly/templates/bootstrapform/field.html` emits: ```html
-
{{ field }}
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。