{ "info": { "author": "Social TRM Ltd", "author_email": "david@socialtrm.com", "bugtrack_url": null, "classifiers": [], "description": "================================\nPopup forms framework for Django\n================================\n\nProblem\n-------\n\n* To have easy way to show popup window, holding any form,\n from any page of the website (examples: send message from user\n profile or from list of profiles; apply/withdraw to pool from\n list of companies, etc.)\n\n* This popup window should be pre-loaded, i.e. there should not\n be HTTP request to server in order to open popup window\n\n* In case form error occurs (some fields are missing,\n email format is wrong, etc.) the same form should be re-populated\n in the same page, indicating errors\n\n* After form is submitted, user should be redirected\n to either the same, or specified page\n\nSolution\n--------\n\nThe solution consists of 4 components:\n\n* Template tag, rendering popup form and link for opening it::\n\n {% popup_form 'id1' popup_forms.ApplyForm '/talent/apply/6/' 'popup_forms/apply_to_pool.html' %}\n {% popup_form 'id2' popup_forms.SomeModelForm '/talent/apply/6/' 'popup_forms/apply_to_pool.html' kwarg1=... kwarg2=... %}\n\n* Decorator for view function, that is processing popup form submission,\n and exception to handle form errors::\n\n import popup_forms\n\n @popup_forms.handler\n def form_view(request):\n if request.method == 'POST':\n form = ApplyForm(request.post)\n if not form.is_valid():\n return popup_forms.OpenFormResponse(request, form)\n # ...\n # ... FORM PROCESSING GOES HERE ...\n # ...\n return popup_forms.CloseFormResponse(request)\n else:\n return redirect('failure_url')\n # or raise Http404\n # or just popup_forms.CloseFormResponse(request)\n\n* Template to render the form, derived from popup_forms/base.html\n* (optional) context processor (popup_forms.context_processors.popup_forms),\n that puts all PopUp form classes to context, in order not to pass it each time in view:\n\n - in settings::\n\n POPUP_FORMS = ('messages.forms.WriteMessageForm',\n 'talentbutton.forms.ApplyForm',\n 'talentbutton.forms.ConfirmForm',)\n\n - in template it could be accessed::\n\n {{ popup_forms.WriteMessageForm }}, etc. \n\n* Decorator to conditionally display popup form on page load\n (for example, to fill in some missing information after registration/login)::\n\n @show_popup_form('/account/register/details/',\n lambda request: 'register-details' in request.session)\n def some_my_view(request):\n ...\n\n\nUse case is following:\n\n* Template tags renders the form, together with link::\n\n Link Title\n
\n
...
\n
\n\n* When user clicks on link, the form, already pre-loaded in template, just makes visible\n* User fills form, and submits it. POST request goes to form processing URL\n* If form is valid, it is processed, handler returns `CloseFormResponse`\n to close the popup form, and user is redirected to success url\n (which by default is the referrer page where popup form was rendered)\n* If form contains errors, handler returns `OpenFormResponse`,\n it is handled by decorator, which stores form data AND ERROR DATA\n in session, and redirects back to referring view\n* The ``{% popup_form %}`` tag then finds data, stored by decorator,\n and re-populates form making it VISIBLE (not hidden) - user\n sees the same form, with errors\n\nConditions\n----------\n\nThere is no separate template to be rendered by form processing view.\nThat's why form processing view should not render anything: it just porcesses forms,\nand makes redirects. If the view renders something, the decorator raises exception.\n\nDisadvantages\n-------------\n\n* If there are many links in the page, for each link a separate form is rendered hiddenly.\n However, HTML of the form does not take much space (less than 1000 characters)\n\n* Right now we have problem to scroll page to the same position\n after re-populating form with errors, but it can be resolved", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/joinourtalents/django-popup-forms", "keywords": "django", "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "django-popup-forms", "package_url": "https://pypi.org/project/django-popup-forms/", "platform": "any", "project_url": "https://pypi.org/project/django-popup-forms/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/joinourtalents/django-popup-forms" }, "release_url": "https://pypi.org/project/django-popup-forms/1.0.3/", "requires_dist": null, "requires_python": null, "summary": "Django pop-up forms framework.", "version": "1.0.3" }, "last_serial": 790315, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "d4b8713c261ebaf5fe26b262f849626f", "sha256": "b5c30bf490c9becb0b5a49aa16f81cc064e5ca6a03ae47040562a4561bf0f19c" }, "downloads": -1, "filename": "django-popup-forms-1.0.1.tar.gz", "has_sig": false, "md5_digest": "d4b8713c261ebaf5fe26b262f849626f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5736, "upload_time": "2012-07-11T15:56:12", "url": "https://files.pythonhosted.org/packages/3c/32/310ca3d29e9b5c6d299b7b1958d036c4af3dd217f04d68d732d230f46c67/django-popup-forms-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "ab36622c0e75d202762b94a2eeb9ec0d", "sha256": "4c553e7f92f0fca7fe22fd05e94ceed15a99c8f857aa756d59e62081cd21116d" }, "downloads": -1, "filename": "django_popup_forms-1.0.2-py2.7.egg", "has_sig": false, "md5_digest": "ab36622c0e75d202762b94a2eeb9ec0d", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 22732, "upload_time": "2012-07-18T14:35:19", "url": "https://files.pythonhosted.org/packages/4f/78/910ff8bf18fd9a695c450d16fdd384b2d020e1b5358f885e201699eb3b95/django_popup_forms-1.0.2-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "9f803eb553a0b6def4ad2fda7d4423f0", "sha256": "492157ac2b286e089d21150a766df9fd9814013f7d1d74f00096d34e5d23d541" }, "downloads": -1, "filename": "django-popup-forms-1.0.2.tar.gz", "has_sig": false, "md5_digest": "9f803eb553a0b6def4ad2fda7d4423f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8245, "upload_time": "2012-07-18T14:38:44", "url": "https://files.pythonhosted.org/packages/de/29/2f048c4d866d091f1b942aeb1f50792742e19d231587cac06d5f69352e7b/django-popup-forms-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "0fda72931cb2ea17a88d0b17e505c020", "sha256": "f5c15096c4fbd0f30ac383cac7822821a816101bc38e4f8e7fcfe821482507f8" }, "downloads": -1, "filename": "django-popup-forms-1.0.3.tar.gz", "has_sig": false, "md5_digest": "0fda72931cb2ea17a88d0b17e505c020", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11279, "upload_time": "2012-07-18T14:45:22", "url": "https://files.pythonhosted.org/packages/67/cc/08c82e44c8a5b05c937e7ab735020d3755654abe054a280ca313c8978f31/django-popup-forms-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0fda72931cb2ea17a88d0b17e505c020", "sha256": "f5c15096c4fbd0f30ac383cac7822821a816101bc38e4f8e7fcfe821482507f8" }, "downloads": -1, "filename": "django-popup-forms-1.0.3.tar.gz", "has_sig": false, "md5_digest": "0fda72931cb2ea17a88d0b17e505c020", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11279, "upload_time": "2012-07-18T14:45:22", "url": "https://files.pythonhosted.org/packages/67/cc/08c82e44c8a5b05c937e7ab735020d3755654abe054a280ca313c8978f31/django-popup-forms-1.0.3.tar.gz" } ] }