{ "info": { "author": "9dev", "author_email": "9devmail@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.4", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "*************\ndjango-embed9\n*************\n\n``django-embed9`` allows you to create widgets from your model objects and embed them on external websites.\n\nRequirements\n============\n\n- `django.contrib.sites `_\n\nInstallation\n============\n\n- Install via pip::\n\n pip install django-embed9\n\n- Add ``embed9`` to your ``INSTALLED_APPS``\n\n- Add url pattern to your urls.py::\n\n url(r'^embed/', include('embed9.urls', namespace='embed9'))\n\n- Create a site in your database and set the SITE_ID setting\n\n- (Optional) Add the following line to your ``robots.txt`` file::\n\n Disallow: /embed/widget/\n\nUsage\n=====\n\nFor every model that you want to make embeddable, create a class extending ``embed9.main.Embeddable`` in ``embed.py`` file inside your app folder. Class name has to consists of your model name and a word ``Embed``.\n\nFor example model ``Image``::\n\n # embed.py\n from embed9.main import Embeddable\n\n class ImageEmbed(Embeddable):\n pass\n\nIn order to provide your own template of the widget, add ``widget_template`` to the class (or define ``get_widget_template()`` method)::\n\n class ImageEmbed(Embeddable):\n widget_template = 'myapp/mywidget.html'\n\nInside the template you can access a context variable named after your model (but in lower case). In this example it would be ``{{ image }}``.\n\nBy default, defined widget template will render as an ``iframe`` on external websites. \n\nTo display a widget preview or raw embed code for an object in the template use the following::\n\n\t{% load embed %}\n\t\n\t{% widget_code myobject %}\n\t{% widget_preview myobject %}\n\t\nTo display an URL to the preview/customization page you can use templatetag ``widget_preview_url``::\n\n\t{% widget_preview_url myobject %}\n\n``django-embed9`` provides a simple demo with example usage. To install it from the console, navigate to ``embed9/demo`` directory and execute ``make install`` command. To run it, type ``make``.\n\nCustomization\n=============\n\nTemplates\n---------\n\nYou may want to change the default templates for embed code or for the JavaScript loader. To do that, specify these templates in your ``Embeddable`` class::\n\n class ImageEmbed(Embeddable):\n code_template = 'myapp/mycode.html'\n loader_template = 'myapp/myloader.js'\n\nAgain, if you need to provide these names dynamically, define ``get_code_template()`` and ``get_loader_template()`` methods.\n\nRemember to use ``{{ widget_name }}`` as shown in the default templates. It is required if you want to allow many widgets on a single page.\n\nOf course, sometimes JavaScript loader is not necessary. If this is the case, you will just need to create a code template similar to::\n\n\t\n\nParameters\n----------\n\nYou may want to add some custom parameters such as widget size or color and allow your users to adjust them.\n\nTo define such parameters, create a form class and tell ``django-embed9`` where it should look for it::\n\n\t# embed.py\n\tclass ImageEmbed(Embeddable):\n\t\tform_class = MyAwesomeForm\n form_template = 'myapp/myform.html'\n \nExample form::\n\n\t# forms.py\n\tclass MyAwesomeForm(forms.Form):\n\t\tsize = forms.IntegerField(max_value=500, min_value=100, initial=200)\n\t\tcolor = forms.CharField(max_length=6)\n\t\nNow all these parameters are going to be passed to the templates as a dictionary named ``{{ params }}``::\n\n\t

Size of this widget should be: {{ params.size }}

\n\nWidget customization is available on the preview page. To display a link to it, write::\n\n\t{% load embed %}\n\t{% widget_preview_url myobject %}\n\nYou can also pass the parameters directly to templatetags::\n\n\t{% load embed %}\n\t{% widget_code myobject size=1000 %}\n\nCaching\n=======\n\nBy default, widgets (iframes and javascript loaders) are cached for an hour. In order to adjust this behaviour, set the ``WIDGET_CACHE_TIME`` setting::\n\n WIDGET_CACHE_TIME = 24 * 60 * 60\n\nIn progress\n===========\n\n- oEmbed API.\n\nNotes\n=========\n\n- Tested with Python 3.4 and Django 1.7.4.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/9dev/django-embed9", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "django-embed9", "package_url": "https://pypi.org/project/django-embed9/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-embed9/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/9dev/django-embed9" }, "release_url": "https://pypi.org/project/django-embed9/0.3/", "requires_dist": null, "requires_python": null, "summary": "Django app that make model objects embeddable on 3rd party websites", "version": "0.3" }, "last_serial": 1442435, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "64a07f013545bf5796408da294d685d7", "sha256": "a03c5fcce595f8ffaef1557616dde34a10e65aad20fa7f09e978243ca8ead53d" }, "downloads": -1, "filename": "django-embed9-0.1.tar.gz", "has_sig": false, "md5_digest": "64a07f013545bf5796408da294d685d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8668, "upload_time": "2015-01-11T12:46:00", "url": "https://files.pythonhosted.org/packages/47/dc/bab83e58c63dff0544e1331c9bfe2222c749dc5d514bd34a68a3c0a0510d/django-embed9-0.1.tar.gz" } ], "0.2": [], "0.3": [ { "comment_text": "", "digests": { "md5": "dfb19287ea36c3b2e9cc8b746135c60c", "sha256": "03e1577f5ca60a05c91e93ce30faba57d60a99586dacd8b69fdff96144f2384d" }, "downloads": -1, "filename": "django-embed9-0.3.tar.gz", "has_sig": false, "md5_digest": "dfb19287ea36c3b2e9cc8b746135c60c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9176, "upload_time": "2015-02-28T17:11:27", "url": "https://files.pythonhosted.org/packages/c9/56/65fdfdf32fdd1901445854175b0fb790505c53a2cf6bc94ae3f56563af9d/django-embed9-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dfb19287ea36c3b2e9cc8b746135c60c", "sha256": "03e1577f5ca60a05c91e93ce30faba57d60a99586dacd8b69fdff96144f2384d" }, "downloads": -1, "filename": "django-embed9-0.3.tar.gz", "has_sig": false, "md5_digest": "dfb19287ea36c3b2e9cc8b746135c60c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9176, "upload_time": "2015-02-28T17:11:27", "url": "https://files.pythonhosted.org/packages/c9/56/65fdfdf32fdd1901445854175b0fb790505c53a2cf6bc94ae3f56563af9d/django-embed9-0.3.tar.gz" } ] }