{ "info": { "author": "Mikhail Podgurskiy", "author_email": "kmmbvnr@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "===============\r\ndjango-viewform\r\n===============\r\n\r\nTemplate driven form rendering for django\r\n\r\nFeatures\r\n========\r\n\r\n* Strong python/html code separation\r\n* Easy redefinition of particular fields rendering\r\n* Complex form layout support\r\n* Formsets and js goodies out of the box\r\n\r\nDemo: http://forms.viewflow.io/\r\n\r\n\r\nInstallation\r\n============\r\n\r\ndjango-viewform tested with Python 2.7/3.3, django 1.6/1.7::\r\n\r\n pip install django-viewform\r\n\r\nAnd add it into INSTALLED_APPS settings\r\n\r\n\r\n INSTALLED_APPS = (\r\n ...\r\n 'viewform',\r\n )\r\n\r\n\r\nQuick start\r\n===========\r\n\r\nInclude formpack javascript and styles into your base template \r\n\r\n\r\n {% include 'viewform/bootstrap3/include_css.html' %}\r\n {% include 'viewform/bootstrap3/include_js.html' %}\r\n\r\nPacks for bootstrap3 and foundation5 are available out of the box\r\n\r\nRender your form with {% viewform %} template tag\r\n\r\n\r\n
\r\n\r\n\r\nTemplate tags\r\n=============\r\n\r\n`viewform` is built around simple concept called viewpart. `Viewpart`\r\nis like django template block, it has a default value and could be\r\noverriden. But `viewparts` are created dynamically for each form\r\nfield, which allows you to redefine specific form field html render output.\r\n\r\nHere is the example of rendering form with predefined bootstrap template,\r\nbut prepend email field with `@` sign.\r\n\r\n\r\n \r\n\r\nThere is a lot of other viewparts declared in default templates. See template code for details.\r\nIf your widget is so special, just provide `{% viewpart form.my_field.field %}any html code{% endviewpart %}`\r\n\r\nLayout\r\n======\r\n\r\nLayout object is the way to specify relative fields placements and sizes.\r\n\r\n\r\n from viewform import *\r\n\r\n layout = Layout(\r\n Row('shipment_no', 'description')\r\n Fieldset(\"Add to inventory\",\r\n Row(Span3('product_name'), 'tags'),\r\n Row('vendor', 'product_type'),\r\n Row(Column('sku',\r\n 'stock_level',\r\n span_columns=4),\r\n 'gender', 'desired_gender'),\r\n Row('cost_price', Span2('wholesale_price'), 'retail_price')))\r\n\r\nSpanXX elements are not directly mapped to bootstrap or foundation grid\r\nclasses, but used to determine relative fields width. Each row occupies\r\n12 grid columns. Elements in Row('elem1', 'elem2') would be rendered\r\nin 6 grid coulmns each, and in Row(Span2('elem1'), 'elem2') `elem1`\r\nwould be rendered in 8 grid columns, and `elem2` in 4 grid columns.\r\n\r\nLayouts rendering itself is specified in template. See\r\ntemplates/viewform/