{ "info": { "author": "Maykin Media, Sergei Maertens", "author_email": "sergei@maykinmedia.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Django", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "======================\nDjango Label Templates\n======================\n\nA custom template loader for multi-site set-ups.\n\n\n.. image:: https://travis-ci.org/maykinmedia/django-label-loaders.svg?branch=master\n :target: https://travis-ci.org/maykinmedia/django-label-loaders\n\n\n.. image:: https://codecov.io/github/maykinmedia/django-label-loaders/coverage.svg?branch=master\n :target: https://codecov.io/github/maykinmedia/django-label-loaders?branch=master\n\n\n.. image:: https://coveralls.io/repos/maykinmedia/django-label-loaders/badge.svg?branch=master&service=github\n :target: https://coveralls.io/github/maykinmedia/django-label-loaders?branch=master\n\n\n.. image:: https://img.shields.io/pypi/v/django-label-templates.svg\n :target: https://pypi.python.org/pypi/django-label-templates\n\n\nThis is intended for users of ``django.contrib.sites`` for multi-site cases\nwhere a different site can have different templates, not only a different\nstyling.\n\nThe custom template loaders will try to find a template for the currently\nactive site, and fall back on a generic template.\n\n\nInstallation\n============\n\nInstall with pip::\n\n pip install django-label-templates\n\n\nConfiguration\n=============\n\nInstalled apps\n--------------\n\nMake sure that ``django.contrib.sites`` is in your ``INSTALLED_APPS``.\n\n\nSpecify template loaders\n------------------------\n\nYou also need to enable the loader in the settings, similar to Django's\ncached template loader. The loader takes an iterable (list or tuple) of\nloaders to find the templates. Example - and probably most used - set-up:\n\n\n.. code-block:: python\n\n TEMPLATES = [\n {\n 'BACKEND': 'django.template.backends.django.DjangoTemplates',\n # APP_DIRS must be False if you specify the loaders yourself\n 'APP_DIRS': False,\n 'DIRS': [\n os.path.join(PROJECT_DIR, 'templates'),\n ],\n 'OPTIONS': {\n 'loaders': [\n ('label_templates.loaders.Loader', [\n 'django.template.loaders.filesystem.Loader',\n 'django.template.loaders.app_directories.Loader',\n ]),\n ],\n },\n },\n ]\n\nIf you wish, this template loader can also be wrapped in other loaders,\nlike ``django.template.loaders.cached.Loader``.\n\n\nConfigure the site labels\n-------------------------\n\nFor the final step, one extra custom settings is required: ``SITELABELS``.\n\n.. code-block:: python\n\n # the import is safe and does NOT depend on django.conf.settings\n from label_templates.sites import SiteLabels, SiteChoice\n\n class SITELABELS(SiteLabels):\n site = SiteChoice('example.com', site_id=1)\n site2 = SiteChoice('example2.com', site_id=2)\n\n\nThis settings is used to look up the label-prefix for the templates. The site\nwith ``ID=1`` will resolve to a subfolder ``site/``, so to load the template\n``example.html``, the loader will try to find ``site/example.html`` first, and\nfailing that, will try to just load ``example.html``.\n\nFor the site with ``ID=2``, the prefix ``site2`` is used.\n\n.. note:: To find the matching site, the loader tries to get the label for the\n ``SiteChoice`` based on ``django.contrib.sites.models.Site.name``, with a\n fallback to ``domain``. So, for the first argument of ``SiteChoice``, it's\n safest to enter the ``Site.name`` value.\n\n\nLimitations\n===========\n\nSince the ``{% extends %}`` tag uses the same loader configuration, you can not\nlet a label-specific template inherit from a generic template with the same\nname.\n\nA workaround is the following structure::\n\n templates/\n \u251c\u2500\u2500 mylabel/\n | \u2514\u2500\u2500 base.html # extends _base.html and overrides stuff\n \u251c\u2500\u2500 _base.html\n \u2514\u2500\u2500 base.html # extends _base.html, overrides nothing\n\n\nVersions supported\n==================\n\nThis library is tested against Django 1.8 and 1.9. The corresponding Python\nversions for the Django versions apply. Consult ``tox.ini`` for an up to date\nbuild matrix.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/maykinmedia/django-label-templates", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-label-templates", "package_url": "https://pypi.org/project/django-label-templates/", "platform": "", "project_url": "https://pypi.org/project/django-label-templates/", "project_urls": { "Homepage": "https://github.com/maykinmedia/django-label-templates" }, "release_url": "https://pypi.org/project/django-label-templates/1.0.3/", "requires_dist": [ "Django (>=1.8)", "django-choices" ], "requires_python": "", "summary": "Load templates from site labels if available", "version": "1.0.3" }, "last_serial": 3759032, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "f0831317e98eeafdd02590ad73945689", "sha256": "c93ea975ad4560068c0961297be79f4477774aaa6d4c55b217caed0cf5ec74d0" }, "downloads": -1, "filename": "django_label_templates-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f0831317e98eeafdd02590ad73945689", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 3763, "upload_time": "2016-01-13T14:47:34", "url": "https://files.pythonhosted.org/packages/b5/1e/a26660475c210c71e881f62bd1def3d977e5a9af33014d13b23aaf3051ce/django_label_templates-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9b6aea8897d0a7f63cfd5eb13d9e152", "sha256": "610a6a9901a0058bd322db41862957943fbb671cf95c6b65a21e2e9ffca8f219" }, "downloads": -1, "filename": "django-label-templates-1.0.0.tar.gz", "has_sig": false, "md5_digest": "b9b6aea8897d0a7f63cfd5eb13d9e152", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2253, "upload_time": "2016-01-13T14:47:26", "url": "https://files.pythonhosted.org/packages/52/66/a9663780840e049bbd9c40797ec4b00377f18488b1fcac7499754399b38b/django-label-templates-1.0.0.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "0ee76704a5b8fc656185923616a7f746", "sha256": "244e271ca6affbc3f097f028c4263abde462c351a513d2b037ee99876de45c00" }, "downloads": -1, "filename": "django_label_templates-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0ee76704a5b8fc656185923616a7f746", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 9794, "upload_time": "2016-01-14T20:53:01", "url": "https://files.pythonhosted.org/packages/16/31/8a7ec0757dfbffd615b131c8aa06d063e01c904d4cf30cf7739e3bfd3ae8/django_label_templates-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9aa54c5fdc55067793c7c50d3aa69717", "sha256": "3fcdcc9ac851e50b956fb0f7cc7b8e108733661a4612bf45af67cfad10e804e7" }, "downloads": -1, "filename": "django-label-templates-1.0.2.tar.gz", "has_sig": false, "md5_digest": "9aa54c5fdc55067793c7c50d3aa69717", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5665, "upload_time": "2016-01-14T20:52:56", "url": "https://files.pythonhosted.org/packages/5d/30/fce4f621c5dfbd89642e88b638a2de55923a10db43b436057c122108db1e/django-label-templates-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "5e8b6b2663cee4a97e53265f4b34b55c", "sha256": "99d43d9296d477e20ccd4f631ffdcd4b3ad189bc8e6fe72a12320592a6207a2d" }, "downloads": -1, "filename": "django_label_templates-1.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5e8b6b2663cee4a97e53265f4b34b55c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7415, "upload_time": "2018-04-12T15:09:12", "url": "https://files.pythonhosted.org/packages/74/b9/3806a528687888f10a2097ba55bea7e1611dad1394200a94dad6cb38b9cb/django_label_templates-1.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "22a6cfc6ecaad9e4b3b314a7eeb0aa2e", "sha256": "b1a2ee1dab1eadbf9a8ac0051e99b35f5e57c0f8e9579b04481344b3d966006e" }, "downloads": -1, "filename": "django-label-templates-1.0.3.tar.gz", "has_sig": false, "md5_digest": "22a6cfc6ecaad9e4b3b314a7eeb0aa2e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5801, "upload_time": "2018-04-12T15:09:13", "url": "https://files.pythonhosted.org/packages/f8/a9/a022375e4b2745c05bd2f869b09510bd806c9a580b5c3faa056eb726fddc/django-label-templates-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5e8b6b2663cee4a97e53265f4b34b55c", "sha256": "99d43d9296d477e20ccd4f631ffdcd4b3ad189bc8e6fe72a12320592a6207a2d" }, "downloads": -1, "filename": "django_label_templates-1.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5e8b6b2663cee4a97e53265f4b34b55c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7415, "upload_time": "2018-04-12T15:09:12", "url": "https://files.pythonhosted.org/packages/74/b9/3806a528687888f10a2097ba55bea7e1611dad1394200a94dad6cb38b9cb/django_label_templates-1.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "22a6cfc6ecaad9e4b3b314a7eeb0aa2e", "sha256": "b1a2ee1dab1eadbf9a8ac0051e99b35f5e57c0f8e9579b04481344b3d966006e" }, "downloads": -1, "filename": "django-label-templates-1.0.3.tar.gz", "has_sig": false, "md5_digest": "22a6cfc6ecaad9e4b3b314a7eeb0aa2e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5801, "upload_time": "2018-04-12T15:09:13", "url": "https://files.pythonhosted.org/packages/f8/a9/a022375e4b2745c05bd2f869b09510bd806c9a580b5c3faa056eb726fddc/django-label-templates-1.0.3.tar.gz" } ] }