{ "info": { "author": "Thomas Massmann", "author_email": "thomas.massmann@inqbus.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "License :: OSI Approved :: Zope Public License", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Introduction\n============\n\nThis package implements a widget that groups select values into optgroups.\n\n\nUsage\n=====\n\nImagine you have the following schema::\n\n\n class IMySchema(Interface):\n country = schema.Choice(\n required=True,\n title=u\"Country\",\n vocabulary='countries',\n )\n\n subdivision = schema.Choice(\n required=True,\n title=u\"State\",\n vocabulary='subdivisions',\n )\n\n region = schema.Choice(\n required=True,\n title=u\"County\",\n vocabulary='regions',\n )\n\n\nWhen you create your vocabularies (e.g. using ``SimpleVocabulary``), instead of adding ``SimpleTerm`` items::\n\n ...\n for country in pycountry.countries:\n terms.append(SimpleTerm(value=country.alpha2, token=country.alpha2,\n title=country.name))\n ...\n\n\nyou add ``OptgroupTerm`` items::\n\n from z3c.formwidget.optgroup.widget import OptgroupTerm\n\n ...\n country_list = countries(context)\n for item in pycountry.subdivisions:\n parent = country_list.getTermByToken(item.country_code).title\n terms.append(OptgroupTerm(value=item.code, token=item.code,\n title=item.name, optgroup=parent))\n ...\n\n\n\nIn your form, simply assign the ``OptgroupFieldWidget``::\n\n from z3c.formwidget.optgroup.widget import OptgroupFieldWidget\n\n class MyForm(form.Form):\n fields = field.Fields(IMySchema)\n\n fields['subdivision'].widgetFactory = OptgroupFieldWidget\n fields['region'].widgetFactory = OptgroupFieldWidget\n\nContributors\n============\n\nThomas Massmann, Author\n\nChangelog\n=========\n\n1.2 (2012-05-01)\n----------------\n\n- Fixed wrong html tag for display mode template.\n [Thomas Massmann]\n\n\n1.1 (2012-04-26)\n----------------\n\n- Always show no value message as first item.\n [Thomas Massmann]\n\n\n1.0.1 (2012-04-14)\n------------------\n\n- MANIFEST.in was missing some entries.\n [Thomas Massmann]\n\n\n1.0 (2012-04-14)\n----------------\n\n- Initial release.\n [Thomas Massmann]", "description_content_type": null, "docs_url": null, "download_url": "http://pypi.python.org/pypi/z3c.formwidget.optgroup", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tmassman/z3c.formwidget.optgroup", "keywords": "zope zope3 z3c.form", "license": "ZPL 2.1", "maintainer": null, "maintainer_email": null, "name": "z3c.formwidget.optgroup", "package_url": "https://pypi.org/project/z3c.formwidget.optgroup/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/z3c.formwidget.optgroup/", "project_urls": { "Download": "http://pypi.python.org/pypi/z3c.formwidget.optgroup", "Homepage": "https://github.com/tmassman/z3c.formwidget.optgroup" }, "release_url": "https://pypi.org/project/z3c.formwidget.optgroup/1.2/", "requires_dist": null, "requires_python": null, "summary": "An optgroup widget for z3c.form.", "version": "1.2" }, "last_serial": 3149752, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "b4e4054e4c3df632600fbac0495f0c62", "sha256": "77cd473a9ce69d35a74bab535b9c514312c2e646f402aaf0147830891d6bc17b" }, "downloads": -1, "filename": "z3c.formwidget.optgroup-1.0.tar.gz", "has_sig": false, "md5_digest": "b4e4054e4c3df632600fbac0495f0c62", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11968, "upload_time": "2012-04-14T12:47:43", "url": "https://files.pythonhosted.org/packages/15/e2/270ed8eb4e40b87c0ebbaf29be4273f23132d3ca4d1e519245846e51aea1/z3c.formwidget.optgroup-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "aaab161bdb73fe70fd785a4b4930c034", "sha256": "441da044ed59edae26a5a0f96f9d01f212669d8b4e81c6fe481fa8cd81b1f6a8" }, "downloads": -1, "filename": "z3c.formwidget.optgroup-1.0.1.tar.gz", "has_sig": false, "md5_digest": "aaab161bdb73fe70fd785a4b4930c034", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12135, "upload_time": "2012-04-14T12:56:22", "url": "https://files.pythonhosted.org/packages/73/58/b3da08ead41e6942539c72adc86f884539a57b37c46ca46095075deaf161/z3c.formwidget.optgroup-1.0.1.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "0e009cd6673841ef29863e9e101e0032", "sha256": "f682f1713e62397c6046a957ff8cccd431891ccde7fdbaa255fc8636e7ed656d" }, "downloads": -1, "filename": "z3c.formwidget.optgroup-1.1.tar.gz", "has_sig": false, "md5_digest": "0e009cd6673841ef29863e9e101e0032", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13161, "upload_time": "2012-04-26T11:19:04", "url": "https://files.pythonhosted.org/packages/97/bf/79b5836357ce3b5bc541277fffec99d1ea690edd40ac4b2f65a73637d98d/z3c.formwidget.optgroup-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "4e40890d4a1ebf930b2078889a69749c", "sha256": "f1de0a23bb87d4aa0661eba563052be399884ea46cdffc7663b62594f146d146" }, "downloads": -1, "filename": "z3c.formwidget.optgroup-1.2.tar.gz", "has_sig": false, "md5_digest": "4e40890d4a1ebf930b2078889a69749c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13223, "upload_time": "2012-05-01T06:11:14", "url": "https://files.pythonhosted.org/packages/21/4a/871e97e3530ed010ac2ddb85dd4087105bff4773cd7bb7ff4243fcf4de74/z3c.formwidget.optgroup-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4e40890d4a1ebf930b2078889a69749c", "sha256": "f1de0a23bb87d4aa0661eba563052be399884ea46cdffc7663b62594f146d146" }, "downloads": -1, "filename": "z3c.formwidget.optgroup-1.2.tar.gz", "has_sig": false, "md5_digest": "4e40890d4a1ebf930b2078889a69749c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13223, "upload_time": "2012-05-01T06:11:14", "url": "https://files.pythonhosted.org/packages/21/4a/871e97e3530ed010ac2ddb85dd4087105bff4773cd7bb7ff4243fcf4de74/z3c.formwidget.optgroup-1.2.tar.gz" } ] }