{ "info": { "author": "Sigma Education", "author_email": "dev@sigmaeducation.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.4", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "django-mashup\n=============\n\ndjango-mashup is a view masher for the Django Framework. Combine multiple views, templates, and/or Ajax loaded urls into a single class-based view.\n\nWrap those views in template-based containers.\n\nDefine different combinations of views and/or containers for different request types.\n\nInstallation\n===============\n\nInstall the module in your Python distribution or virtualenv::\n\n $ pip install git+https://github.com/SigmaEducation/django-mashup.git\n\nAdd the application to your `INSTALLED_APPS`::\n\n```\n INSTALLED_APPS = (...\n \"mashup\",\n ...\n )\n```\n\nUse\n===\n\ndjango-mashup provides one view class:\n\n from mashup.views import MashUp\n \nand three component classes:\n\n from mashup.views import URLMash, TemplateMash, ViewMash\n \nExample:\n\n``` \n from django.core.urlresolvers import reverse\n from mashup.views import MashUp, URLMash, TemplateMash\n \n class MyMashup(MashUp):\n views = [TemplateMash(\"my_app/my_login_instructions.html\"),\n URLMash(reverse('account:login')),\n ]\n \n # my_app/my_login_instructions.html\n \n

Use the following form to log in.

\n```\n\nHere's an example that mashes a view with HTML:\n\n``` \n from django.views.generic.edit import FormView\n from mashup.views import MashUp, TemplateMash, ViewMash\n \n class MyFormView(FormView):\n ...\n \n class MyMashup(MashUp):\n views = [TemplateMash(\"my_app/my_login_instructions.html\"),\n ViewMash(MyFormView),\n ]\n```\n\nEach component class takes an optional container keyword argument. This should be a template name. Use '{{ mashup|safe }}' to specify where the content should be placed:\n\n``` \n from django.core.urlresolvers import reverse\n from mashup.views import MashUp, URLMash, TemplateMash\n \n class MyMashup(MashUp):\n views = [TemplateMash(\"my_app/my_login_instructions.html\",\n container=\"my_app/my_template.html\"),\n URLMash(reverse('account:login')),\n \n ...\n \n # my_app/my_template.html\n \n
{{ mashup|safe }}
\n```\n\nThe three component classes may be subclassed with default containers. The following MyMashup class will produce the same response as the one above:\n\n```\n from django.core.urlresolvers import reverse\n from mashup.views import MashUp, URLMash, TemplateMash\n \n class MyTemplateMash(TemplateMash):\n container = \"my_app/my_template.html\"\n \n class MyMashup(MashUp):\n views = [MyTemplateMash(\"my_app/my_login_instructions.html\"),\n URLMash(reverse('account:login')),\n ] \n```\n\nThe Mashup class may also be given default containers. Here's an abstract subclass of Mashup which takes two views and wraps them in the the divs #left-pane and #right-pane. Any Mashups which inherit from this Mashup will have their views contained in those divs:\n\n```\n from mashup.views import MashUp\n \n class MyPaneMashup(Mashup):\n containers = ('my_app/my_right_pane.html',\n 'my_app/my_left_pane.html',\n )\n \n ...\n \n # my_app/my_right_pane.html\n \n
{{ mashup|safe }}
\n \n ...\n \n # my_app/my_left_pane.html\n \n
{{ mashup|safe }}
\n\n```\n\nFinally, you may define Mashup views and containers by request method: prefix 'views' or 'containers' with the lowercase name of the request method.\n\nFor example, your form views might respond with HTML to GET requests and JSON to POST requests; in this case you do not want your Mashup to attach HTML containers and content to POST response:\n\n```\nfrom mashup.views import Mashup, TemplateMash\n\nfrom myapp.views import MyAjaxFormView\n\n\nclass MyFormMashup(Mashup):\n get_views = (MyAjaxFormView,\n TemplateMash(\"my_app/my_login_instructions.html\", container=\"my_app/my_template.html\"),\n )\n get_containers = ('my_app/my_right_pane.html',\n 'my_app/my_right_pane.html',)\n \n post_views = (MyAjaxFormView,)\n post_containers = ()\n```\nYou may similarly define unique DELETE, PUT, TRACE, etc., views/containers.\n\nCompatibility\n=============\n\n* Django Rest Framework 3.0.1\n* Django 1.7\n* Python 2.7, 3.4\n\nNotes\n=====\nIf you use a custom jquery or javascript function for loading page content via Ajax, you can specify that function by providing your own /templates/mashup/js_jquery_ajax_loader.html.\n\n\nGetting Involved\n================\n\nFeel free to open pull requests or issues. GitHub is the canonical location of this project.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.sigmaeducation.com/", "keywords": null, "license": "GNU General Public License v3 (GPLv3)", "maintainer": null, "maintainer_email": null, "name": "django-mashup", "package_url": "https://pypi.org/project/django-mashup/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-mashup/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://www.sigmaeducation.com/" }, "release_url": "https://pypi.org/project/django-mashup/0.7.1/", "requires_dist": null, "requires_python": null, "summary": "Combine multiple views, templates, and/or ajax loaded urls into a single view.", "version": "0.7.1" }, "last_serial": 1366408, "releases": { "0.7.1": [ { "comment_text": "", "digests": { "md5": "5be93cc59aedeb43676e66ce90c4f45a", "sha256": "bed75176b54a4bda9f8023805fa01a76064c8684a79413ceeac35be524525027" }, "downloads": -1, "filename": "django-mashup-0.7.1.tar.gz", "has_sig": false, "md5_digest": "5be93cc59aedeb43676e66ce90c4f45a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18231, "upload_time": "2014-12-31T20:49:02", "url": "https://files.pythonhosted.org/packages/06/a5/34a2109ca754d6130f48a0a74ca9e9703468194ba7ca2d7be4894d3f94d2/django-mashup-0.7.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5be93cc59aedeb43676e66ce90c4f45a", "sha256": "bed75176b54a4bda9f8023805fa01a76064c8684a79413ceeac35be524525027" }, "downloads": -1, "filename": "django-mashup-0.7.1.tar.gz", "has_sig": false, "md5_digest": "5be93cc59aedeb43676e66ce90c4f45a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18231, "upload_time": "2014-12-31T20:49:02", "url": "https://files.pythonhosted.org/packages/06/a5/34a2109ca754d6130f48a0a74ca9e9703468194ba7ca2d7be4894d3f94d2/django-mashup-0.7.1.tar.gz" } ] }