{ "info": { "author": "Chris McDonough, Agendaless Consulting", "author_email": "pylons-discuss@googlegroups.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: Repoze Public License", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "Deform\n======\n\n.. image:: https://travis-ci.org/Pylons/deform.png?branch=master\n :target: https://travis-ci.org/Pylons/deform\n\n.. image:: https://readthedocs.org/projects/deform/badge/?version=master\n :target: http://docs.pylonsproject.org/projects/deform/en/master/\n :alt: Master Documentation Status\n\n.. image:: https://readthedocs.org/projects/deform/badge/?version=latest\n :target: http://docs.pylonsproject.org/projects/deform/en/latest/\n :alt: Latest Documentation Status\n\n.. contents:: :local:\n\n\nIntroduction\n------------\n\nDeform is a Python form library for generating HTML forms on the server side.\n`Date and time picking widgets `_,\n`rich text editors `_, `forms with\ndynamically added and removed items\n`_ and a few other `complex\nuse cases `_ are supported out of the box.\n\nDeform integrates with the `Pyramid web framework `_\nand several other web frameworks. Deform comes with `Chameleon templates\n`_ and `Bootstrap 3\n`_ styling. Under the hood, `Colander schemas\n`_ are used for serialization and\nvalidation. The `Peppercorn `_ library\nmaps HTTP form submissions to nested structure.\n\nAlthough Deform uses Chameleon templates internally, you can embed rendered\nDeform forms into any template language.\n\nUse cases\n---------\n\nDeform is ideal for complex server-side generated forms. Potential use cases\ninclude:\n\n* Complex data entry forms\n\n* Administrative interfaces\n\n* Python based websites with high amount of data manipulation forms\n\n* Websites where additional front end framework is not needed\n\nInstallation\n------------\n\nInstall using `pip and Python package installation best practices `_::\n\n pip install deform\n\nExample\n-------\n\n`See all widget examples `_. Below is a sample\nform loop using the `Pyramid `_ web framework.\n\n.. image:: https://github.com/Pylons/deform/raw/master/docs/example.png\n :width: 400px\n\nExample code:\n\n.. code-block:: python\n\n \"\"\"Self-contained Deform demo example.\"\"\"\n from __future__ import print_function\n\n from pyramid.config import Configurator\n from pyramid.session import UnencryptedCookieSessionFactoryConfig\n from pyramid.httpexceptions import HTTPFound\n\n import colander\n import deform\n\n\n class ExampleSchema(deform.schema.CSRFSchema):\n\n name = colander.SchemaNode(\n colander.String(),\n title=\"Name\")\n\n age = colander.SchemaNode(\n colander.Int(),\n default=18,\n title=\"Age\",\n description=\"Your age in years\")\n\n\n def mini_example(request):\n \"\"\"Sample Deform form with validation.\"\"\"\n\n schema = ExampleSchema().bind(request=request)\n\n # Create a styled button with some extra Bootstrap 3 CSS classes\n process_btn = deform.form.Button(name='process', title=\"Process\")\n form = deform.form.Form(schema, buttons=(process_btn,))\n\n # User submitted this form\n if request.method == \"POST\":\n if 'process' in request.POST:\n\n try:\n appstruct = form.validate(request.POST.items())\n\n # Save form data from appstruct\n print(\"Your name:\", appstruct[\"name\"])\n print(\"Your age:\", appstruct[\"age\"])\n\n # Thank user and take him/her to the next page\n request.session.flash('Thank you for the submission.')\n\n # Redirect to the page shows after succesful form submission\n return HTTPFound(\"/\")\n\n except deform.exception.ValidationFailure as e:\n # Render a form version where errors are visible next to the fields,\n # and the submitted values are posted back\n rendered_form = e.render()\n else:\n # Render a form with initial default values\n rendered_form = form.render()\n\n return {\n # This is just rendered HTML in a string\n # and can be embedded in any template language\n \"rendered_form\": rendered_form,\n }\n\n\n def main(global_config, **settings):\n \"\"\"pserve entry point\"\"\"\n session_factory = UnencryptedCookieSessionFactoryConfig('seekrit!')\n config = Configurator(settings=settings, session_factory=session_factory)\n config.include('pyramid_chameleon')\n deform.renderer.configure_zpt_renderer()\n config.add_static_view('static_deform', 'deform:static')\n config.add_route('mini_example', path='/')\n config.add_view(mini_example, route_name=\"mini_example\", renderer=\"templates/mini.pt\")\n return config.make_wsgi_app()\n\nThis example is in `deformdemo repository `_. Run the example with pserve::\n\n pserve mini.ini --reload\n\nStatus\n------\n\nThis library is actively developed and maintained. Deform 2.x branch has been used in production on several sites since 2014. Automatic test suite has 100% Python code coverage and 500+ tests.\n\nProjects using Deform\n---------------------\n\n* `Websauna `_\n\n* `Kotti `_\n\n* `Substance D `_\n\nCommunity and links\n-------------------\n\n* `Widget examples `_\n\n* `PyPi `_\n\n* `Issue tracker `_\n\n* `Widget examples repo `_\n\n* `Documentation `_\n\n* `Support `_\n\n\n2.0.8 (2019-10-07)\n------------------\n\n- Add HTML5 attributes to buttons.\n See https://github.com/Pylons/deform/pull/390\n\n\n2.0.7 (2018-11-14)\n------------------\n\n- Add `tags` option support to `Select2Widget`\n See https://github.com/Pylons/deform/pull/373\n\n- Change Python 3.7 to use stable version, 3.8-dev as allowed failure, in\n Travis.\n See https://github.com/Pylons/deform/pull/377\n\n- Update Bootstrap to 3.3.7.\n\n- Add support for HTML5 attributes (e.g. including placeholder and maxlength)\n See https://github.com/Pylons/deform/pull/345\n\n2.0.6 (2018-08-29)\n------------------\n\n- Drop Python 3.3 support.\n See https://github.com/Pylons/deform/pull/371\n\n- Add support to Python 3.7.\n\n- Make date_submit and time_submit optional in DateTimeInputWidget\n See https://github.com/Pylons/deform/pull/369\n\n- Remove pinning of iso8601 to 0.1.11\n See https://github.com/Pylons/deform/pull/364\n\n- i18n cleanup https://github.com/Pylons/deform/pull/367 and https://github.com/Pylons/deform/pull/368\n\n2.0.5 (2018-02-20)\n------------------\n\n- i18n cleanup https://github.com/Pylons/deform/pull/332 and https://github.com/Pylons/deform/pull/363\n\n- Fix bug in ``_FieldStorage`` under Python 3.x (issues #339 and #357).\n\n- Declare Python 3.6 compatibility and enable tests against Python 3.6 (all tests pass with no changes).\n\n- Closes #333: MANIFEST.in including docs, licenses and text files.\n\n- Add ``link`` button type See https://github.com/Pylons/deform/issues/166\n\n- Add traditional chinese localization\n\n2.0.4 (2017-02-11)\n------------------\n\n- Added ability to pass a translator function to `deform.renderer.configure_zpt_renderer`\n\n\n2.0.3 (2016-11-19)\n------------------\n\n- Added accordions to MappingWidget: http://deformdemo.repoze.org/mapping_accordion/\n\n- Added CSS class ``deform-form-buttons`` to style form button group: https://github.com/Pylons/deform/pull/308\n\n- Add more options to ``TextAreaCSVWidget``: https://github.com/Pylons/deform/pull/309\n\n- Always render an item with a default CSS class: https://github.com/Pylons/deform/pull/306\n\n- Updated pickdate.js library used for the date picker: https://github.com/Pylons/deform/pull/248\n\n- Widget Selenium test suite runs both under Python 2 and 3. Lots of Selenium testing headache fixed with some implicit wait support.\n\n.. note ::\n\n Currently Python 3 file upload widget may have compatibility issues Please see deformdemo/test.py for details.\n\n2.0.2 (2016-11-14)\n------------------\n\n- Fix regression of ``