{ "info": { "author": "Johnny Lee", "author_email": "jleeothon@outlook.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": "=======\ncancl\u00f3n\n=======\n\nTemplate name resolution for Django class-based views\n\n------------\nIntroduction\n------------\n\n*Cancl\u00f3n* is a local name for the horned screamer, `Anhima cornuta`_. This is a group of `class-based views`_ for Django_. The simple flexibility and DRYness_ of this group of classes is comparable to that of horned screamer's horn_.\n\n.. _`Anhima cornuta`: https://en.wikipedia.org/wiki/Horned_screamer\n.. _`class-based views`: https://docs.djangoproject.com/en/dev/topics/class-based-views/\n.. _Django: http://djangoproject.com/\n.. _DRYness: http://en.wikipedia.org/wiki/Don't_repeat_yourself\n.. _horn: https://www.youtube.com/watch?v=1esf6WNdvso\n\nDjango's default method for template name resolution has a couple of not-so-niceties for more advanced developers, such as default template suffixes appended with an underscore (yay for dashes) and an assumption of HTML files (you might want to include other extension, such as ``.jade``). This project gives you the flexibility of having everybody need to stick to a set of standards, or as well phase slowly into a standard by permitting more template names to be selected.\n\nWarning:\n\n Including this functionality in your project makes template name resolution DRYier and more flexible but a bit slower.\n\nCancl\u00f3n's ``TemplateNameResolverMixin`` allows you to calculate the template name for a class-based view using:\n\n- The class-based view's ``model`` name, automatically calculated.\n- A list of suffixes, e.g. your Create view could be \"product-create.html\", \"product-edit.html\" or \"product-form.html\".\n- A list of separators, i.e. take \"product-create.html\" or \"product_create.html\".\n- A list of extensions, i.e. \"html\", \"jade\".\n\nWarning:\n\n You will override Django's template name resolution method.\n\n---------------\nInstallation\n---------------\n\nYou first need pip_ installed. Also, you might want a virtualenv_ (which will usually give you a scoped pip, too).\n\n.. _pip: https://pypi.python.org/pypi/pip\n.. _virtualenv: http://virtualenv.readthedocs.org/en/latest/\n\nUse the command::\n\nTo install the latest official release, use::\n\n pip install django-canclon\n\nTo install the latest version, use::\n\n pip install git+git://github.com/jleeothon/canclon.git\n\nVoil\u00e0, instalation finished.\n\n-----\nUsage\n-----\n\nExtend ``canclon.TemplateNameResolverMixin`` to your class to enable functionality.\n\nOverride the class' ``template_suffixes``, ``template_suffix_separators`` and ``template_extensions``::\n\n class ProductCreateView(TemplateNameResolverMixin, CreateView):\n template_suffixes = ('create', 'editing', 'form')\n template_suffix_separators = ('-', '_')\n template_extensions = ('html', 'jade')\n\nThe default separator is a dash (``'-'``) and de default extension is ``html``.\n\nYou can also set the default separators and extensions in your ``settings.py``::\n\n # settings.py\n\n TEMPLATE_SUFFIX_SEPARATORS = ('-*-',) # feeling fancy in this project\n TEMPLATE_EXTENSIONS = ('jade',)\n\n..\n\n **Warning!** Not overriding template_suffixes will result in no template name candidates being produced.\n\n\nBased on suffixes, suffix joints and extensions, a list of all posible combinations is returned. They take the form ``1/234.5``, where:\n\n- 1 is the app label\n- 2 is the model name\n- 3 is separator (joint)\n- 4 is the suffix\n- 5 is the file extension\n\nWhen a suffix is an empty string, the separator and suffix are omitted.\n\n---------------\nRecommendations\n---------------\n\nFor any new category of class-based views, e.g. a \"Search\" view, create a custom inheritable class to avoid repeating the suffix and separator everywhere. As such, TemplateNameResolverMixin will be your class' \"grandparent\".\n\nFor single custom class-based views, inherit direct from TemplateNameResolverMixin.\n\nDon't use too many suffixes, extensions or separators, as this will make resolution slower.\n\n---------------\nTroubleshooting\n---------------\n\nIf you stumble upon bug, file a bug in the \"issues\" section. If possible, helping track and solve the bug would be cool.\n\n---------------------\nEnhancement proposals\n---------------------\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nSupport \"atoms\" apart from iterables\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nUsing ``template_suffixes`` = '-' instead of ``('-',)`` may be nice.\n\n~~~~~~~~~~~~~~~\nLazy evaluation\n~~~~~~~~~~~~~~~\n\nNot exactly like I can do anything about it.\n\nIf Django could receive a lazy object for ``get_template_names`` instead of a pre-evaluated iterable, this implementation would be both more time-efficient and space-efficient in best and average scenarios.", "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/jleeothon/canclon", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-canclon", "package_url": "https://pypi.org/project/django-canclon/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-canclon/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/jleeothon/canclon" }, "release_url": "https://pypi.org/project/django-canclon/0.2.3/", "requires_dist": null, "requires_python": null, "summary": "Template name resolution for Django class-based views", "version": "0.2.3" }, "last_serial": 1203265, "releases": { "0.1.3": [ { "comment_text": "", "digests": { "md5": "739de2cd283434cb0e0b5580bc33289e", "sha256": "f54a3b3c459b69008b02628f2e77d69744728d0d5b08cc0c8c91d5c2fb40dde6" }, "downloads": -1, "filename": "django-canclon-0.1.3.tar.gz", "has_sig": false, "md5_digest": "739de2cd283434cb0e0b5580bc33289e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4523, "upload_time": "2014-08-22T03:11:59", "url": "https://files.pythonhosted.org/packages/29/2d/3ac01e609c2c5e80f4430d6cefce96df882eea7f70d8d587fd0de2a4c8ef/django-canclon-0.1.3.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "771a1b00fa98d700815f03f7e0d9ec12", "sha256": "cde02529ba3405bc262a31afb7f48b96b9410fbdb5ec2feeae12a0a310ae6ec2" }, "downloads": -1, "filename": "django-canclon-0.2.1.tar.gz", "has_sig": false, "md5_digest": "771a1b00fa98d700815f03f7e0d9ec12", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5140, "upload_time": "2014-08-26T18:02:00", "url": "https://files.pythonhosted.org/packages/69/10/0ee4305ad2443f2f7e7112eba5c2580a31c0ecb2eedad37f47d97a8e25ab/django-canclon-0.2.1.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "d28f141ed9291a2e050dc23ee76d013e", "sha256": "61ebc9eeb417c6db7daf13de2771d4114325160cc529f15a85fbc544c819560c" }, "downloads": -1, "filename": "django-canclon-0.2.3.tar.gz", "has_sig": false, "md5_digest": "d28f141ed9291a2e050dc23ee76d013e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5108, "upload_time": "2014-08-26T18:42:24", "url": "https://files.pythonhosted.org/packages/88/ae/c1e7a06a5f0a12791ad4bb430409408f128c481fc564598a7500826f363a/django-canclon-0.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d28f141ed9291a2e050dc23ee76d013e", "sha256": "61ebc9eeb417c6db7daf13de2771d4114325160cc529f15a85fbc544c819560c" }, "downloads": -1, "filename": "django-canclon-0.2.3.tar.gz", "has_sig": false, "md5_digest": "d28f141ed9291a2e050dc23ee76d013e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5108, "upload_time": "2014-08-26T18:42:24", "url": "https://files.pythonhosted.org/packages/88/ae/c1e7a06a5f0a12791ad4bb430409408f128c481fc564598a7500826f363a/django-canclon-0.2.3.tar.gz" } ] }