{ "info": { "author": "Ian Jabour", "author_email": "l4nk332@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "# Django Stash Tag\n\nA Django template tag that allows for markup to be stashed and\ndynamically applied *without* needing to create a separate partial or\ntemplate tag file.\n\n## Installation\n\nInstall Django Stash Tag:\n\n```\npip install django-stash-tag\n```\n\nAfter you've installed the tag, add `django_stash_tag` to\n`INSTALLED_APPS` in your `settings.py` file:\n\n```\n# settings.py\n\nINSTALLED_APPS = (\n # \u2026\n 'django_stash_tag',\n)\n```\n\n## Static Usage\n\nThe `stash` tag can be used to store static markup for reuse further\ndown the template. Using `stash_apply` you can render the stashed\nmarkup.\n\nFirst we load the tag and stash the markup with a name to stash it\nunder:\n\n```\n{% load stash %}\n\n{% stash 'static_heading' %}\n

User: {{user.name}}

\n{% endstash %}\n```\n\nWe then apply the stash with `stash_apply` and provide the stash name\n`static_heading` as a tag argument:\n\n```\n{% stash_apply 'static_heading' %}\n```\n\nThis would result in rendering (`context.user` is `{'name': 'Ivan'}`):\n\n```\n

User: Ivan

\n```\n\n## Dynamic Usage\n\nIn most cases you probably need more dynamic control over the\nparamaterization of the stashed markup. You can accomplish such\nbehavior through the use of template tag kwargs.\n\nAgain we load the tag and stash the markup. This time the context\nvariables that are referenced within the stashed content are not\ndefined in the template's context:\n\n```\n{% load stash %}\n\n{% stash 'section_header' %}\n
\n

{{title}} {{company}}

\n {{subtext}} {{company}}.\n
\n{% endstash %}\n```\n\nWe then apply the stash with additional template kwargs pertaining to\nthe context variables referenced in the stashed content\n(`context.company` set to `{'name': 'GitHub'}`):\n\n```\n{% stash_apply 'section_header'\n title='About'\n subtext='We will take you back to when it all began at'\n%}\n\n{# further down in the template #}\n\n{% stash_apply 'section_header'\n title='Apply for a Position at'\n subtext='Make software development a better experience at'\n%}\n```\n\nWhich would then output:\n\n```\n
\n

About GitHub

\n We will take you back to when it all began at GitHub.\n
\n\n \n\n
\n

Apply for a Position at GitHub

\n Make software development a better experience at GitHub.\n
\n```\n\nAs demonstrted above you can use `stash_apply` as much as you\nwant once you've stashed the content in your template. You can use both\ncontext variables already set on the template or dynamic variables set\nthough kwargs.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/l4nk332/django-stash-tag", "keywords": "django,templatetag,template,tag,stash,dynamic", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-stash-tag", "package_url": "https://pypi.org/project/django-stash-tag/", "platform": "", "project_url": "https://pypi.org/project/django-stash-tag/", "project_urls": { "Homepage": "https://github.com/l4nk332/django-stash-tag" }, "release_url": "https://pypi.org/project/django-stash-tag/19.3.0/", "requires_dist": [ "django (>=1.11)" ], "requires_python": "", "summary": "A Django Template Tag that stashes content for dynamic reuse.", "version": "19.3.0" }, "last_serial": 4954601, "releases": { "19.3.0": [ { "comment_text": "", "digests": { "md5": "40a89ef2544f015526e322af5e6cc65c", "sha256": "e280246735c314010bbc479f216403946f07cae652a48c969c9269d6db817014" }, "downloads": -1, "filename": "django_stash_tag-19.3.0-py2-none-any.whl", "has_sig": false, "md5_digest": "40a89ef2544f015526e322af5e6cc65c", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3649, "upload_time": "2019-03-18T15:46:27", "url": "https://files.pythonhosted.org/packages/f7/9a/ca52d9542b3d5e284cf8dd0e59deb35fd4b019e54da2b64b214bd5d231a4/django_stash_tag-19.3.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4ec07d17eefb590845c0040c566ea4f5", "sha256": "37d52d133c27995d65028f77859cf2f98c57a65023d5ab9bb5639abf85360bf8" }, "downloads": -1, "filename": "django-stash-tag-19.3.0.tar.gz", "has_sig": false, "md5_digest": "4ec07d17eefb590845c0040c566ea4f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3234, "upload_time": "2019-03-18T15:46:29", "url": "https://files.pythonhosted.org/packages/23/cc/048e28302b6f7faf80dd53363f110101143cbf184df626f774524d5b18d3/django-stash-tag-19.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "40a89ef2544f015526e322af5e6cc65c", "sha256": "e280246735c314010bbc479f216403946f07cae652a48c969c9269d6db817014" }, "downloads": -1, "filename": "django_stash_tag-19.3.0-py2-none-any.whl", "has_sig": false, "md5_digest": "40a89ef2544f015526e322af5e6cc65c", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3649, "upload_time": "2019-03-18T15:46:27", "url": "https://files.pythonhosted.org/packages/f7/9a/ca52d9542b3d5e284cf8dd0e59deb35fd4b019e54da2b64b214bd5d231a4/django_stash_tag-19.3.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4ec07d17eefb590845c0040c566ea4f5", "sha256": "37d52d133c27995d65028f77859cf2f98c57a65023d5ab9bb5639abf85360bf8" }, "downloads": -1, "filename": "django-stash-tag-19.3.0.tar.gz", "has_sig": false, "md5_digest": "4ec07d17eefb590845c0040c566ea4f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3234, "upload_time": "2019-03-18T15:46:29", "url": "https://files.pythonhosted.org/packages/23/cc/048e28302b6f7faf80dd53363f110101143cbf184df626f774524d5b18d3/django-stash-tag-19.3.0.tar.gz" } ] }