{ "info": { "author": "Vladimir Savin", "author_email": "zero13cool@yandex.ru", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "django-vest\n===========\n\n.. image:: https://img.shields.io/pypi/v/django-vest.svg\n :target: https://pypi.python.org/pypi/django-vest\n :alt: Latest PyPI version\n\n.. image:: https://travis-ci.org/zerc/django-vest.svg?branch=master\n :target: https://travis-ci.org/zerc/django-vest\n :alt: Build status\n\nExtension for default template system for making inheritance more flexible. Adding some kind of themes.\n\nUsage\n-----\nImagine you have several sites on different hosts. They differ by visually and small functional. ``django-vest`` this is a way to use one code base for this situation.\n\nHe allowing to split templates on ``themes`` - one per site. We also have extended inheritance between themes - we have `DEFAULT_THEME` and we can override each template in `CURRENT_THEME`. Exmaple:\n\n.. code:: html\n\n {% extends 'DEFAULT_THEME/index.html' %}\n {% block page_title %}Dark theme{% endblock %}\n\n``django-vest`` have some tools for logic splitting according by ``CURRENT_THEME`` in views. Assume we have some ``form`` class who is different in each theme. Then our code may looks like:\n\n\n.. code:: python\n\n # forms.py\n from django_vest.decorators import themeble\n\n @themeble(name='Form', themes=('dark_theme',))\n class DarkThemeForm(object):\n ''' Some kind of logic/fields for dark_theme form\n '''\n name = 'DarkThemeForm'\n\n\n @themeble(name='Form')\n class DefaultForm(object):\n ''' Default logic/fields for all themes\n '''\n name = 'Default form'\n\n\n # views.py\n from .forms import Form\n\n\nIn example bellow ``Form`` class will be alias for DarkThemeForm if ``settings.CURRENT_THEME == 'dark_theme'`` otherwise it is ``DefaultForm``.\n\nIf you want restricting access to views according by ``CURRENT_THEME`` just use ``only_for`` decorator:\n\n.. code:: python\n\n # views.py\n from django.http import Http404\n from django.views.generic.base import TemplateView\n\n from django_vest import only_for\n\n @only_for('black_theme')\n def my_view(request):\n ...\n\n # Redirect for special page\n dark_theme_page = only_for('dark_theme', redirect_to='restict_access')(\n TemplateView.as_view(template_name='dark_theme_page.html'))\n\n # Raise Http404 when user trying to open page with invalid theme\n dark_theme_page_not_found = \\\n only_for('dark_theme', raise_error=Http404)(\n TemplateView.as_view(template_name='dark_theme_page.html'))\n\n\n**Extends for default templates**\n\nVersion 0.1.3 has a new template loader ``django_vest.templates_loaders.AppsLoader`` and new keyword ``DJANGO_ORIGIN``.\n\nNow we can override default django admin template without copy past of full origin file.\n\nExample:\n\nFile: ``templates/main_theme/admin/change_list.html``\n\n.. code:: html\n\n {% extends \"DJANGO_ORIGIN/admin/change_list.html\" %}\n {% load i18n admin_urls admin_static admin_list %}\n\n {% block breadcrumbs %}\n
Template has been overridden
\n {{ block.super }}\n {% endblock %}\n\n\nInstallation\n------------\n\n.. code:: bash\n\n $ pip install django_vest\n\nAnd add next setting options to your ``settings.py``:\n\n.. code:: python\n\n TEMPLATE_LOADERS = (\n 'django_vest.templates_loaders.Loader',\n 'django_vest.templates_loaders.AppsLoader',\n )\n\n DEFAULT_THEME = 'main_theme'\n\n # Unique for each host\n CURRENT_THEME = 'dark_theme'\n\nOr you can set os environment:\n\n.. code:: bash\n\n export DJANGO_VEST_CURRENT_THEME=dark_theme\n\nAlso you can specify list of backends for getting settings. Default is:\n\n.. code:: python\n\n VEST_SETTINGS_BACKENDS_LIST = (\n 'django_vest.config.backends.simple',\n 'django_vest.config.backends.env'\n )\n\n* django_vest.config.backends.simple - getting settings about theme from project`s settings file.\n* django_vest.config.backends.env - from os envirom\n\nThen you need to update structure of your templates like this:\n\n.. code:: bash\n\n exampleproject/templates/\n | - dark_theme\n | - index.html\n | - main_theme\n | - index.html\n\n**IMPORTANT**: theme folder must ends with *_theme* suffix (example: my_super_mega_theme)\n\nOther config backends (Experimental)\n------------------------------------\nDjango-vest have are several other backends like:\n\n``django_vest.config.backends.database``. If you have some singleton model for store settings of your site you can use ``django_vest.fields.VestField`` for storing information of **CURRENT_THEME** in database.\n\nFor activating this feature you must do next steps:\n\n* Add ``django_vest.fields.VestField`` to you settings model and migrate.\n* Add ``django_vest.config.backends.database`` backend to top of VEST_SETTINGS_BACKENDS_LIST setting. Example:\n\n.. code:: python\n\n VEST_SETTINGS_BACKENDS_LIST = (\n 'django_vest.config.backends.database',\n 'django_vest.config.backends.simple',\n 'django_vest.config.backends.env',\n )\n\n\nContributing\n------------\n\n1. Fork the `django-vest` repo on GitHub.\n2. Clone your fork locally:\n\n.. code:: bash\n\n $ git clone git@github.com:your_name_here/django-vest.git\n\n3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:\n\n.. code:: bash\n\n $ mkvirtualenv django-vest\n $ cd django-vest/\n $ python setup.py develop\n\n4. Create a branch for local development:\n\n.. code:: bash\n\n $ git checkout -b name-of-your-bugfix-or-feature\n\n Now you can make your changes locally.\n\n5. When you're done making changes, check that your changes pass the tests, including testing other Python versions with tox:\n\n.. code:: bash\n\n $ make test-all\n\n6. Commit your changes and push your branch to GitHub:\n\n.. code:: bash\n\n $ git add .\n $ git commit -m \"Your detailed description of your changes.\"\n $ git push origin name-of-your-bugfix-or-feature\n\n7. Submit a pull request through the GitHub website.\n\n\nLicence & Authors\n-------------------\nThe MIT License (MIT)\n\nCopyright (c) 2015 `Vladimir Savin `_.", "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/zerc/django-vest", "keywords": "django-vest", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-vest", "package_url": "https://pypi.org/project/django-vest/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-vest/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/zerc/django-vest" }, "release_url": "https://pypi.org/project/django-vest/0.1.6/", "requires_dist": null, "requires_python": null, "summary": "Extension for default template system for making inheritance more flexible. Adding some kind of themes.", "version": "0.1.6" }, "last_serial": 1660744, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3ec33932ffe7bba65277c15702cd9539", "sha256": "bb3b77718961ca283acf161e80d5b9598a5df690ce01390741b69cebeb188e79" }, "downloads": -1, "filename": "django-vest-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3ec33932ffe7bba65277c15702cd9539", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4759, "upload_time": "2015-06-12T10:03:12", "url": "https://files.pythonhosted.org/packages/b9/85/d7cea4cf23d7746e575702f05cc6e6e20c945018d30ed22c1163de1a8620/django-vest-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "479a26333c0a71fb64e4efebbf8a092a", "sha256": "1f8b8cd2bb571024a04fecc4fd427dcf49e08669e7132af1239597222ff29ae2" }, "downloads": -1, "filename": "django-vest-0.1.1.tar.gz", "has_sig": false, "md5_digest": "479a26333c0a71fb64e4efebbf8a092a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5372, "upload_time": "2015-06-13T20:28:28", "url": "https://files.pythonhosted.org/packages/7f/23/230d724db5972dfd192a6890d30b263b92bc4c8e122a7b2b315bd0250eab/django-vest-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "72ba35ef362ce770f8881761d2a92b56", "sha256": "ac8ce48ba4c701dd76a57b2961366a484272cfe9e609a3c01eefd7bf3fa9edd9" }, "downloads": -1, "filename": "django-vest-0.1.2.tar.gz", "has_sig": false, "md5_digest": "72ba35ef362ce770f8881761d2a92b56", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5624, "upload_time": "2015-06-13T20:48:14", "url": "https://files.pythonhosted.org/packages/27/75/94c6e9e114655c25c472266df8f70bfb07f14139f6e854c0697aac34a3e9/django-vest-0.1.2.tar.gz" } ], "0.1.2a": [ { "comment_text": "", "digests": { "md5": "82fe8a5f10f0e310e0a9dc8e76087841", "sha256": "2b96be4dca11b5f63ff05f3835dddaf099e1de55a182c504bd10ce3a81c11ce4" }, "downloads": -1, "filename": "django-vest-0.1.2a.tar.gz", "has_sig": false, "md5_digest": "82fe8a5f10f0e310e0a9dc8e76087841", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5623, "upload_time": "2015-06-13T20:52:15", "url": "https://files.pythonhosted.org/packages/8b/2b/6a244b8eafef2ea8927b9ecde68e373ec76ebf773b6f36430eb83dcac76f/django-vest-0.1.2a.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "2ce799583656b843a80dfdcf0a09e40d", "sha256": "eb889088ef0381b8973ab1e2b8776ef9ae875bddc1ae8252d058dbe803d34f90" }, "downloads": -1, "filename": "django-vest-0.1.3.tar.gz", "has_sig": false, "md5_digest": "2ce799583656b843a80dfdcf0a09e40d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6270, "upload_time": "2015-06-14T21:18:54", "url": "https://files.pythonhosted.org/packages/06/2e/24a1e4f6d542c88426bbacc6fd7020603b8eeb892a1ebfa6f272d27d16ae/django-vest-0.1.3.tar.gz" } ], "0.1.3a": [ { "comment_text": "", "digests": { "md5": "05e051bdef088723518e0666122b37dd", "sha256": "aeade7891ea564a565d58ef49a4d15cffa3433d5c7d80312bd76e75f03642e7e" }, "downloads": -1, "filename": "django-vest-0.1.3a.tar.gz", "has_sig": false, "md5_digest": "05e051bdef088723518e0666122b37dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6316, "upload_time": "2015-06-21T15:23:18", "url": "https://files.pythonhosted.org/packages/7d/78/65fba79a66ac2ed46199d2f24be4fa783b4a773432e420244788273dbaa2/django-vest-0.1.3a.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "d1769a9e5073d8fd4704ad4c9656e852", "sha256": "62d96db9ed9c341a97d59e246f1e70795508d07a8a73a77bee0858ebf608e8b5" }, "downloads": -1, "filename": "django-vest-0.1.4.tar.gz", "has_sig": false, "md5_digest": "d1769a9e5073d8fd4704ad4c9656e852", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6420, "upload_time": "2015-07-04T18:21:50", "url": "https://files.pythonhosted.org/packages/4c/11/99d51c79a47af57bfc7c0f224d774dd212512aab374f873c5e824a08d342/django-vest-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "4e7f5a9b1b781e658c128fba46bac9c5", "sha256": "c50e9cd03a20ce7928b4c8a49ef237a8bf192b46ceb3e3f8fdb3a2f97dfb8c7e" }, "downloads": -1, "filename": "django-vest-0.1.5.tar.gz", "has_sig": false, "md5_digest": "4e7f5a9b1b781e658c128fba46bac9c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7098, "upload_time": "2015-07-19T19:14:40", "url": "https://files.pythonhosted.org/packages/87/4c/30dcfcd5010e119b753ba5c4888453f4d2f0bc758ab8afbac9637da4de58/django-vest-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "f28daaf99cbfa4f9ee5b4da1688405b9", "sha256": "9aae507c5d116432399af626c4ec57787d175aa185d77f92ec2934f306cca0cc" }, "downloads": -1, "filename": "django-vest-0.1.6.tar.gz", "has_sig": false, "md5_digest": "f28daaf99cbfa4f9ee5b4da1688405b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9154, "upload_time": "2015-08-02T14:54:09", "url": "https://files.pythonhosted.org/packages/0d/50/030f7b907ccca1901c7ba4f1093635a6e9e6e59496089effdf2ad0048f7d/django-vest-0.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f28daaf99cbfa4f9ee5b4da1688405b9", "sha256": "9aae507c5d116432399af626c4ec57787d175aa185d77f92ec2934f306cca0cc" }, "downloads": -1, "filename": "django-vest-0.1.6.tar.gz", "has_sig": false, "md5_digest": "f28daaf99cbfa4f9ee5b4da1688405b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9154, "upload_time": "2015-08-02T14:54:09", "url": "https://files.pythonhosted.org/packages/0d/50/030f7b907ccca1901c7ba4f1093635a6e9e6e59496089effdf2ad0048f7d/django-vest-0.1.6.tar.gz" } ] }