{ "info": { "author": "Troy Melhase", "author_email": "troy@troy.io", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "Context Layers for Django\n==========================\n\nThis app provides \"context layers\" for Django templates. A context\nlayer is a model object that contributes data to a template during\nrendering.\n\nContext layers match on URL paths. When a match is found, the model\nrecord is asked for data to contribute, and that data is sent along to\nthe template context.\n\nContext layers have activation dates. You can set the layer to turn\non (become active) at a specific date/time, and also to turn off\n(become inactive).\n\nContext layers were originally developed to provide:\n\n * Additional CSS to a page; see the sample app for an implementation\n * Selective enabling or disabling of adverts\n * Conditional markup during a site beta period\n\nThis package doesn't provide any concrete models, so you still have to\nprovide your own models to specify what your layers do (in other\nwords, how your layers contribute to the context). Again, see the\nsample app for an implementation.\n\n\nInstall\n-------\n\nPull down the app:\n\n $ pip install django-contextlayers\n\nAdd it to your `INSTALLED_APPS`:\n\n INSTALLED_APPS = (\n ...\n 'contextlayers'\n )\n\nThen include the context processor in your settings:\n\n TEMPLATE_CONTEXT_PROCESSORS = (\n ...\n 'contextlayers.context_processors.layer_tool',\n )\n\n\nMaking Your Own Layers\n----------------------\n\nFirst you define a layer class. You'll probably want to subclass\n`LayerBase`, but it's not strictly necessary. You must include a\n`LayerMeta` property, and you must supply a `contribute_to_context`\nmethod. Example from the sample:\n\n from contextlayers.models import LayerBase\n\n class ThemeLayer(LayerBase):\n markup = models.TextField(...)\n\n class LayerMeta:\n pass\n\n def contribute_to_context(self, layer_context, global_context):\n layer_context.setdefault('theme', []).append(self.markup)\n\nWhen this layer is matched, the content of the `markup` field will be added\nto the template at `layers.theme`.\n\nNext, sync your database:\n\n $ ./manage.py syncdb\n\nThe layers won't be visible until you add support to your templates.\nFor example:\n\n {% for css in layers.theme %}\n {{ css|safe }}\n {% endfor %}\n\nWhat you do with `layers.*` depends on what the layer provides to the\ncontext and how your templates should use it.\n\nFinally, define the layer records in the Django admin. Take note of\nthe help text for the dates and path values.", "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/natural/django-contextlayers", "keywords": null, "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "django-contextlayers", "package_url": "https://pypi.org/project/django-contextlayers/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-contextlayers/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/natural/django-contextlayers" }, "release_url": "https://pypi.org/project/django-contextlayers/0.1/", "requires_dist": null, "requires_python": null, "summary": "Slather your templates with contextual data.", "version": "0.1" }, "last_serial": 674796, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "297b5645bdab1afaff6c7f2f625d2629", "sha256": "a99fcb41dddaee89b416343b24f29fa2db08782a156dc1095afb7221d45384b0" }, "downloads": -1, "filename": "django-contextlayers-0.1.tar.gz", "has_sig": false, "md5_digest": "297b5645bdab1afaff6c7f2f625d2629", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4604, "upload_time": "2013-05-21T18:57:51", "url": "https://files.pythonhosted.org/packages/ea/80/ce78a1e18c97b3c9936c5dde791c156b6a153183de27ebb5ca882c5a1a2e/django-contextlayers-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "297b5645bdab1afaff6c7f2f625d2629", "sha256": "a99fcb41dddaee89b416343b24f29fa2db08782a156dc1095afb7221d45384b0" }, "downloads": -1, "filename": "django-contextlayers-0.1.tar.gz", "has_sig": false, "md5_digest": "297b5645bdab1afaff6c7f2f625d2629", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4604, "upload_time": "2013-05-21T18:57:51", "url": "https://files.pythonhosted.org/packages/ea/80/ce78a1e18c97b3c9936c5dde791c156b6a153183de27ebb5ca882c5a1a2e/django-contextlayers-0.1.tar.gz" } ] }